I can't get the validation to clear on a row when I press escape/cancel the edit. I have attached a picture without my work-around that shows grid row BST 1 and BST 3 I entered an invalid value then pressed escape. The current row is BST 5.
- Add DataAnnotations on your class properties (like String Length).
- Create a List<Class>
- Bind a RadGridView to the List.
- Enter an invalid value so the validations flag in the grid.
- Press escape.
At this point, I expected the "red" validations in the row to clear... but they don't. I figured out a work around which seems odd and I'm hoping that you can give me a better way of doing this.
Grid Definition:
<
telerik:RadGridView
x:Name
=
"formGrid"
ShowColumnSortIndexes
=
"False"
ShowGroupPanel
=
"False"
ShowInsertRow
=
"True"
ColumnWidth
=
"125"
AlternateRowBackground
=
"Cornsilk"
AlternationCount
=
"2"
AutoGeneratingColumn
=
"formGrid_AutoGeneratingColumn"
ValidatesOnDataErrors
=
"InEditMode"
ScrollViewer.HorizontalScrollBarVisibility
=
"Visible"
ScrollViewer.VerticalScrollBarVisibility
=
"Visible"
EnableColumnVirtualization
=
"False"
RowEditEnded
=
"formGrid_RowEditEnded"
/>
Work Around:
private
void
formGrid_RowEditEnded(
object
sender, GridViewRowEditEndedEventArgs e)
{
if
(e.EditAction == GridViewEditAction.Cancel)
{
((RadGridView)sender).Rebind();
}
}