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

Exception in cell validation on RadGridView edit mode, disables keyboard

1 Answer 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Karthi
Top achievements
Rank 1
Karthi asked on 18 Nov 2014, 09:35 AM
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();
            }
        }
    }

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 19 Nov 2014, 02:48 PM
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.

 
Tags
GridView
Asked by
Karthi
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or