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
590
Trouble setting the rows to readOnly
posted

I have a grid that has AllowAddNew = true and AllowDelete = true;

It works great except the fact that I have trouble setting all the rows that have been added to have a readonly setting.

I want the users to use the top row to add new rows and not give the user the ability to update any existing rows in the grid.

Is there a way to accomplish this?

 

  • 69686
    Suggested Answer
    posted

    Hello, 

    You can do that with the following steps:

    1. create a variable currentAddRecord, which will be used to get the added record:

    DataRecord currentAddRecord;

    2. Handle the RecordAdded event and set that currentAddRecord to e.Record

    void xamDataGrid1_RecordAdded(object sender, Infragistics.Windows.DataPresenter.Events.RecordAddedEventArgs e)
    {
    currentAddRecord = e.Record;
    }

    3. Handle the RecordUpdated event and disable this record :

    if (e.Record == currentAddRecord)
    e.Record.IsEnabled = false;

    Let me know if you have questions on this matter.

    Alex.