Editing columns that is not shown in grid

Dec 5, 2011 at 8:53 AM

Hi,

My data object has over 20 properties and i would not like to show them all in the grid. However I still need to be able to show them when editing an item.

I use .SetColumns to add the columns, but how do i add additional columns that should only be displayed while editing a row?

Thanks for a great control.

Coordinator
Dec 5, 2011 at 9:50 PM

Hi,

Set the columns as hidden, and use the SetCustomAttributes method of the GridColumnModel to add "editrules: {edithidden:true}", e.g:

Html.Grid(new GridControl()
        .SetIsAutoSize(true)
        .SetListUrl("/Search/List")
        .SetColumns<Store>(cs=>
            {
                cs.Add(x => x.StoreId).SetAsPrimaryKey();
                cs.Add(x => x.Name).SetHidden(true).SetCustomAttributes("editrules: {edithidden:true}");
                cs.Add(x => x.Address);
                cs.Add(x => x.Calculated);
            }))

 

Dec 6, 2011 at 1:34 PM

Great, it's working :)