RadGridView when exception thrown on cell editing disables keyboard

2 posts, 0 answers
  1. Karthi
    Karthi avatar
    2 posts
    Member since:
    Mar 2011

    Posted 18 Nov 2014 Link to this post

    Hi,

    When an exception is throw during cell validation in RadGridView edit mode, disables the keyboard.

    I am using Telerik for WPF 2014 - Q2 (Version-2014.2.0729.45).

    In the attached sample, click on the first cell (Robert), Click F2 to begin the edit mode.
    Try providing a name that is already exists (Eric) and exception will be thrown.
    Close the message box and try typing anything in the cell which will not accept any keyboard inputs.

    Please let me know if this issue can be fixed.
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 18 Nov 2014 Link to this post

    Hello,

    Thank you for attaching a sample project to illustrate the issue.

    I debugged the demo and as it turns out a TargetInvocationException is thrown in your code. Once I commented it committing the edit worked as expected.
    void HandleCellValidating(object sender, GridViewCellValidatingEventArgs e)
    {
        if (studentList.Any(s => s.FirstName == e.NewValue.ToString()))
        {
            e.Handled = true;
            //throw new Exception();
        }
    }

    As I understand throwing an Exception is how you validate the user input and the problem is that this disables the keyboard input. I was indeed able to reproduce the exact described issue with our latest version.

    Generally, I would suggest you to use our Validating mechanism instead of throwing an exception. How does it work for you? Is there a special reason why do you need raising an Exception specifically?

    Regards,
    Dimitrina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top