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

RadGridView display cells for multiple error when loading

3 Answers 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tan
Top achievements
Rank 1
Tan asked on 19 Jun 2014, 02:21 AM
Hi Telerik, 

I would like to do like this: When I load the RadGridView (NOT when I validate cells), it will show me all the data with cell that has errors will be highlighted/ border by red color. If there are multiple errors in different cells, all the error cells will have red border color with tooltip.   

How can I do this?

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 20 Jun 2014, 08:14 AM
Hi,

You can check the Validating documentation on the validation options we suggest.

Then, you can try setting the ValidatesOnDataErrors="InViewMode" after the data has been loaded. 

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Tan
Top achievements
Rank 1
answered on 20 Jun 2014, 10:31 AM
I try using cell validation, look like this one:

private void radGridView_CellValidating( object sender, Telerik.Windows.Controls.GridViewCellValidatingEventArgs e )
{
if ( e.Cell.Column.UniqueName == "OrderNO" )
{
if ( e.NewValue.ToString().Length < 5 )
{
e.IsValid = false;
e.ErrorMessage = "OrderNO must be longer than five characters.";
}
}
}

and set ValidatesOnDataErrors="InViewMode" but no validation is made when the radGridView is loaded.

Can you help? Thanks.


0
Dimitrina
Telerik team
answered on 20 Jun 2014, 11:27 AM
Hello,

This validation will take effect when the CellValidating event is raised. It will be raised for a cell when you commit editing a cell. Therefore, this code will not be executed initially.
You can implement the IDataErrorInfo interface to get the validation initially.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Tan
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Tan
Top achievements
Rank 1
Share this question
or