The new version of RadGridView is coming in May (as beta) and I am eager to show you some of the new features.
There are many methods to indicate errors in RadGridView. However, until now it didn’t support the most natural and easy way for this - the IDataErrorInfo interface. Things have changed, so let me show you how to use this interface.
As MSDN says,“IDataErrorInfo provides the functionality to offer custom error information that a user interface can bind to.”
Actually, you don't need to know anything about this interface. You can just set the ErrorText property of the desired row or cell:
"There is an error!"
"Invalid cell value!"
RadGridView will automatically display error indication at the beginning of the row and will set tooltips. You can also use the ContainsErrors property which indicates whether a cell or row contain errors. You should handle the CellFormatting event in this case:
sender, CellFormattingEventArgs e)
GridDataCellElement cell = e.CellElement
cell.BorderBoxStyle = BorderBoxStyle.SingleBorder;
cell.BorderWidth = 2;
cell.BorderColor = Color.Red;
However, when you want to display help information based on some condition, you should implement the IDataErrorInfo. In that case you have to implement only two properties:
Employee : IDataErrorInfo
(!IsEmailValid() || !IsNameValid() || !IsPhoneValid())
"Please enter valid data in this row!"
"This is not a valid email!"
//... return string.Empty;
I hope you like this feature. If you have any comments or ideas we will be glad to hear them.
Nikolay Diyanov Diyanov is the Product Manager of the Native Mobile UI division at Progress. Delivering outstanding solutions that make developers' lives easier is his passion and the biggest reward in his work. In his spare time, Nikolay enjoys travelling around the world, hiking, sun-bathing and kite-surfing.
Find him on Twitter @n_diyanov or on LinkedIn.
Copyright © 2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.