This is a migrated thread and some comments may be shown as answers.

edit cell with '-'

1 Answer 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nadia Sangiovanni
Top achievements
Rank 1
Nadia Sangiovanni asked on 22 May 2012, 03:57 PM
Dear Support,

We use RadGridView with decimal column. If the user position to a cell with the keyboard and try to enter the value -123.456 the value will be 123.456. The '-' sign put the cell in edit mode but don't display in the cell? The demo have the same behavior (GridView - Columns - Column Types) with the decmal column. To be working the correct way, the user have to enter --123.456 by typing 2 times - sign...

Is there a way to trap the '-' sign and display as the current value of the cell?

Regards,
Nadia

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 25 May 2012, 06:47 AM
Hi Nadia,

Thank you for writing.

The described behavior is exactly what happens. One way to overcome it is to send another press of the subtract key in the PreviewKeyDown event:

void radGridView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
    if (radGridView1.CurrentColumn is GridViewDecimalColumn && e.KeyCode == Keys.Subtract)
    {
        System.Windows.Forms.SendKeys.Send("{SUBTRACT}");
    }
}

Let me know how this works for you.
 
Kind regards,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Nadia Sangiovanni
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or