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
750
How to disable columns in Webgrid?
posted

I have a webgrid in my form in which some of my columns are editable and some are not editable. Now I want to disable columns which are not editable.

Following is the code for WinUltraGrid. I want to do same thing in my webversion also.

 

void EditMode(bool enabled)

{

 

for (int i = 0; i < reportUltraGrid.DisplayLayout.Bands[0].Columns.Count; i++)

{

reportUltraGrid.DisplayLayout.Bands[0].Columns[i].CellActivation = (enabled

?

Activation.Disabled

:

Activation.NoEdit);

}

}

}

Thanks

 

 

  • 45049
    Suggested Answer
    posted

    WebGrid does not have the concept of a "disabled" cell, row, or column, not in the same way that WinGrid has.

    To simulate this "disabled" effect, set the CellStyle properties of your column to "gray out" or otherwise adjust the appearance of the column.  To prevent the user from editing values in the column, set that column's AllowUpdate property to No (Infragistics.WebUI.UltraWebGrid.AllowUpdate.No if doing so in code).