Hi
I have a decimal Column in RadGridView with BeginEditMode = BeginEditOnKeystrokeOrF2 and using Danish culture.
When user presses ',' on the selected cell, cell goes to edit mode but ',' is not inserted in the cell. But if user now again presses comma, then it is inserted into the cell.
So if user wants to enter the value ,5 he has to press comma twice. Ofcourse he has no problom in entering 0,5
Note, this is when user enters to edit mode by pressing , not by pressing F2.
What should I do? Any help would be appreciated.
Thanks
Regards
4 Answers, 1 is accepted
0
                                Accepted
                                                    Richard Slade
                                                    
                                            
    Top achievements
    
            
                
                Rank 2
            
    
                                                
                                                answered on 24 Jan 2011, 03:02 PM
                                            
                                        Hi again Michael, 
I think this will do what you want.
hope that helps. Let me know if you have any questions
Richard
                                        I think this will do what you want.
this.radGridView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.radGridView1_KeyDown); private void radGridView1_KeyDown(object sender, KeyEventArgs e) {     if (this.radGridView1.CurrentCell.ColumnInfo is GridViewDecimalColumn)     {         if (e.KeyValue == 188)         {             this.radGridView1.Rows[this.radGridView1.CurrentRow.Index].Cells[this.radGridView1.CurrentColumn.Index].BeginEdit();             SendKeys.Send("\u002C");         }     } }hope that helps. Let me know if you have any questions
Richard
0
                                
                                                    Zerka
                                                    
                                            
    Top achievements
    
            
                
                Rank 1
            
    
                                                
                                                answered on 25 Jan 2011, 09:16 AM
                                            
                                        Thanks!
                                        0
                                
                                                    Zerka
                                                    
                                            
    Top achievements
    
            
                
                Rank 1
            
    
                                                
                                                answered on 01 Feb 2011, 01:47 PM
                                            
                                        Hi Richard
Actually now I wants when user presses - to a cell, cell should be in edit mode and - should also be put in the cell. So I did the following code:
This is working fine with OemMinus. But for Subtract, it is not working. What I come to know is that KeyDown event of RadGridView is not calling for Subtract. So I used the Keyup event but at that time above code is not working.
Can you provide some solution for this?
Thanks
Regrads
                                        Actually now I wants when user presses - to a cell, cell should be in edit mode and - should also be put in the cell. So I did the following code:
if (e.KeyCode == Keys.OemMinus || e.KeyCode == Keys.Subtract) {     if (dtgCpr.CurrentCell.ColumnInfo is GridViewDecimalColumn && dtgCpr.CurrentCell.ColumnInfo.ReadOnly == false)     {         dtgCpr.Rows[dtgCpr.CurrentRow.Index].Cells[dtgCpr.CurrentColumn.Index].BeginEdit();         SendKeys.Send("\u002D");     } }This is working fine with OemMinus. But for Subtract, it is not working. What I come to know is that KeyDown event of RadGridView is not calling for Subtract. So I used the Keyup event but at that time above code is not working.
Can you provide some solution for this?
Thanks
Regrads
0
                                Accepted
                                                    Richard Slade
                                                    
                                            
    Top achievements
    
            
                
                Rank 2
            
    
                                                
                                                answered on 01 Feb 2011, 02:14 PM
                                            
                                        Hi Michael, 
This ought to do the trick. (remember to remove the current check for - from the Key Down event)
Hope that helps
Richard
                                        This ought to do the trick. (remember to remove the current check for - from the Key Down event)
this.radGridView1.KeyPress += new KeyPressEventHandler(radGridView1_KeyPress);           void radGridView1_KeyPress(object sender, KeyPressEventArgs e)         {             if (this.radGridView1.CurrentCell.ColumnInfo is GridViewDecimalColumn)             {                 char c = Convert.ToChar("-");                 if (e.KeyChar == c)                 {                     this.radGridView1.Rows[radGridView1.CurrentRow.Index].Cells[radGridView1.CurrentColumn.Index].BeginEdit();                     SendKeys.Send("\u002D");                 }             }         }Hope that helps
Richard