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
395
Prevent cell editing two records ahead?
posted

Hello Infragistics,

I need to prevent my users from editing more than one row 'ahead' of the currently new row.

Here is the process flow:

1) The xamDataGrid is loaded with rows of information

2) Some event happens, and the user is now going to enter a new row

3) I want them to only be able to enter the next row at a time; in other words I want to say okay here is the next available, and you can enter information in any one of those 'new' cells/columns, but you may not edit anything beyond that until the 'current' row is committed.

Is there an easy way to accomplish this?

Thank you in advance for any help

Parents
No Data
Reply
  • 69686
    Suggested Answer
    posted

    Hello,

    For this requirement, you would have to save somewhere the last record that has been deactivated, so that you know which record you should allow to enter edit mode. Here is one way to achieve this:

    Record deactivated=null;

    void xamDataGrid1_EditModeStarting(object sender, Infragistics.Windows.DataPresenter.Events.EditModeStartingEventArgs e)
            {
                if (deactivated != null)
                {
                    if (e.Cell.Record.Index > deactivated.Index + 1)
                    {
                        e.Cancel = true;
                        return;
                    }
                }
                deactivated = e.Cell.Record;
            }

Children
No Data