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

Row Validation does not clear on Cancel

1 Answer 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joel Palmer
Top achievements
Rank 2
Joel Palmer asked on 14 Aug 2013, 06:19 PM

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();
    }
}

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 15 Aug 2013, 01:39 PM
Hi Joel,

I've tried to reproduce the problem you report but to no avail. I have prepared a sample project using the Q2 2013 SP1 version of our controls. Could you check it and modify it in order to demonstrate the issue? 

Looking forward to hearing from you! 

Regards,
Yoan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Joel Palmer
Top achievements
Rank 2
Answers by
Yoan
Telerik team
Share this question
or