Exception in cell validation on RadGridView edit mode, 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 there is an exception thrown during cell validation in RadGridView edit mode, the keyboard is disabled.

    Added the sample code below. Please let me know if this issue can be fixed.

    // App.xaml
     
    <Application x:Class="SampleAppWithRadGridView.App"
        StartupUri="MainWindow.xaml"
        DispatcherUnhandledException="Application_DispatcherUnhandledException" />
     
     
    // App.xaml.cs
     
     
            private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
            {
                e.Handled = true;
                MessageBox.Show(e.Exception.Message);
            }
     
    // MainWindow.xaml
     
    <telerik:RadGridView Name="gridView" IsReadOnly="False" EditTriggers="F2" Width="200"></telerik:RadGridView>
     
    // MainWindow.xaml.cs
     
    public partial class MainWindow : Window
        {
            IList<Student> studentList = new List<Student>();
             
            public MainWindow()
            {
                InitializeComponent();
                InitializeStudentList();
                LoadGrid();
            }
     
            void InitializeStudentList()
            {
                studentList.Add(new Student { FirstName = "Robert", LastName = "Williams" });
                studentList.Add(new Student { FirstName = "Eric", LastName = "James" });
                studentList.Add(new Student { FirstName = "Randy", LastName = "Spencer" });
                gridView.ItemsSource = studentList;
            }
     
            void LoadGrid()
            {
                gridView.CellValidating += HandleCellValidating;
            }
     
            void HandleCellValidating(object sender, GridViewCellValidatingEventArgs e)
            {
                if (studentList.Any(s => s.FirstName == e.NewValue.ToString()))
                {
                    e.Handled = true;
                    throw new Exception();
                }
            }
        }
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 19 Nov 2014 Link to this post

    Hello,

    I replied to the forum post you opened on the same topic.

    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