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
igGrid - readonly attributes for updating a record, non-readonly attributes for adding a record

Hello Infragistics community, 

Im using an ASP.Net MVC igGrid. I want my grid to have following behaviour. If I add a new record to my igGrid, i want all my attributes / columns of my grid to be editable. 

When i want to update a record of my igGrid, i want some  attributes / columns to be readonly. I have tried setting some of my columns to read only. This solved my problem

when i want to update a record. But when i want to add a record, theses attribtes are now readonly. 

ReadOnly on columns

Is there a way to set the read only attributes separately for adding and editing a record?

thank you very much for the help.


No Data
  • 17590
    Verified Answer
    Offline posted

    Hello Adrian,

    Having some columns read only when editing and editable when adding row could be accomplished by handling editCellStarting event which is cancellable. In this event, via the ui argument we could check whether the event is raised while new-row-adding and the key of the column that triggered it. If the event is triggered from editing a particular column in an existing row we could cancel it and basically this will make this column read only. For example:

      .Columns(col =>
                col.For(c => c.ProductID).HeaderText("ProductID").Hidden(false);
                col.For(c => c.Name).HeaderText("Name");
                col.For(c => c.ReleaseDate).HeaderText("ReleaseDate");
                col.For(c => c.ProductNumber).HeaderText("Product Number");
                col.For(c => c.Col1).HeaderText("Value 1");
                col.For(c => c.Col2).HeaderText("Value2");
                col.For(c =>c.Total).HeaderText("Total");
      .Features(features =>
            //Bind after initialization      
            $(document).delegate("#grid1", "iggridupdatingeditcellstarting", function (evt, ui) {
                if (!ui.rowAdding && ui.columnKey == "Name" ) {
                    return false;

    Please test this approach on your side and let me know whether it helps you achieve your requirement.