Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3521
How to allow escape from AddNewRowSettings
posted

I have a grid with AllowAddNewRow set to bottom.  I am processing the RowExitingEditMode event to do data validation, canceling the event if validation fails.  However, I need a way to allow the user to just 'nevermind' the whole add row scenario.

What I was thinking of was like an escape functionality, such as the escape key would just erase the input up until that point.  Any hints on how to wire this up?

Here is an example snippet of what happens on validation..

 

  117     Private Sub dgpro_RowExitingEditMode(ByVal sender As Object, _

  118                                          ByVal e As Infragistics.Silverlight.ExitEditingRowEventArgs) _

  119                                          Handles dgpro.RowExitingEditMode

  120 

  121         Dim data As PTProject = e.Row.Data()

  122 

  123         Me._blnAddEventCancelled = False

  124 

  125         If Not e.EditingCanceled Then

  126 

  127             If data.Company Is Nothing OrElse data.Company = String.Empty Then

  128 

  129                 MessageBox.Show("Please Enter Company.", "Proliance Mapping", MessageBoxButton.OK)

  130 

  131                 e.Cancel = True

  132 

  133                 Me._blnAddEventCancelled = True

  134 

  135             Else

Parents
No Data
Reply
  • 40030
    Suggested Answer
    Offline posted

    Hi Alan, 

    Try something like:
                if (e.Row.RowType == RowType.AddNewRow)
                {

                    if (!e.EditingCanceled)
                    {

                        e.Cancel = true;

                        this.grid.ExitEditMode(true);

                    }

                }

     

    Hope this helps, 

    -SteveZ

Children