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
Webdatagrid initializelayout equavalent

My webdatagrid getting data from a datasource. After assigning into the datasource, I like to format column headers, hide some columns and format cells. Usually in ultradatagrid we do this through Initialize layout event. How to achieve the same in webdatagrid?

  • 17590
    Offline posted

    Hello BlueWhale,

    Thank you for posting in the community.

    I know it`s been a while since you posted but if you are still in a need of assistance I would be glad to help.

    Columns collection in WebDataGrid contains only the columns objects that were added by hand in either aspx or in the code behind file. The autogenerated columns are for display purpose only, they cannot be accessed or modified.

    WebDataGrid works with items instead of columns. What I can suggest for achieveing you requirement is handling InitializeRow event and set the colum headers, whether the column to be hidden or not etc. as such:


    protected void WebDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)


           //reffer to a particular column in the grid

            e.Row.Items[0].Column.Header.Text ="Enter your header text here";

            e.Row.Items[0].Column.Hidden =true;

           //reffer to a particular cell in the grid

    var cellText = e.Row.Items[0].Value.ToString();



    Please keep in mind that you have to have at least one row initialized in the grid in order to fire the Initialize Row event.

    I hope you find this information helpful.

    Feel free to contact me if you have any additional questions regarding this matter.



Reply Children