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

After "enter", how to stop entering edit mode on next row?

3 Answers 149 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 26 Nov 2011, 06:03 PM
I have editmode of the gridview on "default" (I've tried F2 also").  The problem is that after I edit the current row and press "enter", the gridview automatically put focus in the next row (which is ok), but it also put the next row into edit mode.  How do I stop that?  The reason I want to stop that is that I have a "messagebox" to confirm save changes in the rowvalidating event.  And when the user pressed "ok" or "cancel" on the current editing row, the gridview put next row into edit mode two which when user try to get out of that row, it also prompt them the messagebox which I don't want.

Thanks in advance

3 Answers, 1 is accepted

Sort by
0
Marc Roussel
Top achievements
Rank 2
answered on 02 Apr 2012, 12:31 PM
I have almost the same question which is to stop edit mode as my scenario is to have the grid to go at the newly added row however I don't know what you do but in the 2012.1.326.1050 when I press ENTER, the grid stops automatically to be in Edit mode the problem is when the user press TAB at the last column for a newly added row.  This goes to the second row in edit mode but the customer's request is to have the grid go to the newly added row and not in edit mode so he may enter additional information for that row elsewhere  So in brief, ENTER is all right with the code bellow but not TAB.  In a EDIT scenario I would understand but when adding a new row it's a bit different.  I actually have a support tiket going on asking for what to do in case the user press TAB at the last column of a newly added row in order to go to that row and stop being in edit mode like the ENTER does

My RowEditEnded is actually as follow :

private void rgvCustomers_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
{
    //-------------------------------------------------------------------------------------------------------
    // Either Edit or Insert should save my commited row that's why I'm just checking if the row was commited
    //-------------------------------------------------------------------------------------------------------
  
    if (e.EditAction == Telerik.Windows.Controls.GridView.GridViewEditAction.Commit)
    {
        ShowBusyIndicator(true);
  
        if (e.EditOperationType == Telerik.Windows.Controls.GridView.GridViewEditOperationType.Insert)
        {
            rgvCustomers.CurrentColumn = rgvCustomers.Columns[0];
            rgvCustomers.ScrollIntoView(e.NewData);
            SelectedCustomer = e.NewData as ProxyCode.Proxy_Customer;
            rgvCustomers.CurrentItem = SelectedCustomer;
        }
  
        Proxy.SaveCustomerAsync(Gear.ServiceKey(), e.EditedItem as ProxyCode.Proxy_Customer);
    }
    else
        CustomerDetailContainer.DataContext = SelectedCustomer;
}
0
Hubert Frick
Top achievements
Rank 1
answered on 27 Jul 2012, 04:24 PM
I have exactly the same scenario, as Frank describes in his post. I can compare all the old values with the new values of the row, and only continue with saving the data when modified data is entered. It would be nice if there would be an easier approach, I couldn't find any!
0
Saif
Top achievements
Rank 1
answered on 01 Apr 2013, 08:58 PM

After "enter", how to stop entering edit mode on next row

I have this same issue on my grids...... any replies to this post ???

thanks
Tags
GridView
Asked by
Frank
Top achievements
Rank 1
Answers by
Marc Roussel
Top achievements
Rank 2
Hubert Frick
Top achievements
Rank 1
Saif
Top achievements
Rank 1
Share this question
or