edit cell with '-'

2 posts, 0 answers
  1. Nadia Sangiovanni
    Nadia Sangiovanni avatar
    38 posts
    Member since:
    Apr 2010

    Posted 22 May 2012 Link to this post

    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
  2. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 25 May 2012 Link to this post

    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 >>
Back to Top