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

Invoke GridViewCellValidating for all cells

1 Answer 6 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Abhilash
Top achievements
Rank 1
Abhilash asked on 10 Aug 2016, 04:27 PM

I am using RadGridView and using CellValidating event to handle errors and display error message:

private static void GridViewCellValidating(object sender, GridViewCellValidatingEventArgs e)
{
    var validationText = string.Empty;
    var isValid = true;
 
    var cell = e.Cell;
 
     //Some business logic here for to set isValid and validationText based on which column the cell belongs to
 
    e.ErrorMessage = validationText;
    e.IsValid = isValid;
}

The event gets fired when I move away from cell, and is fired for the same cell only from which user moved out.

I need this event to be fired for all cells in the recently added row as soon as user clicks outside the grid so that all the cell contents are validated.

Currently since all cells doesn't get validated, user is able to invoke final 'Save' functionality since there is no validation error message.

Looking forward for your suggestion

 

Regards,
Abhilash

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 15 Aug 2016, 10:12 AM
Hello Abhilash,

I'm a little uncertain about your exact requirements, but I believe the RowValidating approach should be suitable for this scenario.

Could you please give it a try and let me know if it works for you? If that is not the case, please provide more details about your exact requirements and I will gladly assist you further.

Regards,
Dilyan Traykov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Abhilash
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or