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
190
Dynamically assign column data.
posted

I am using UltrawebGrid and binding with a datasource in codebehind. I want to bind the ultrawebgrid columns based on the datasource values and also want to change the colour of that cell. Please advice how to proceed.

Parents
  • 49378
    posted

    Hi MPF_COGNIZANT,

    Thank you for posting in the community.

    In order to define the datasource field used for a column in UltraWebGrid, you may set the BaseColumnName property. For instance:

            UltraWebGrid1.Columns[0].BaseColumnName = "ID";
            UltraWebGrid1.DisplayLayout.AutoGenerateColumns = false;
            UltraWebGrid1.DataSource = populateGrid();
            UltraWebGrid1.DataBind();

    The base column name can be dynamically/conditionally changed in order to implement your requirement. Styling individual cells may be done in the InitializeRow handler by accessing the style of the particular cell:

             e.Row.Cells[0].Style.ForeColor = System.Drawing.Color.Green;

    Please note that the UltraWebGrid control is now outdated and as of .NetAdvantage 2011 Volume 2 is no longer included in our product package. I would suggest that you consider switching to the WebDataGrid/WebHieararchicalDataGrid. More information regarding these controls is available at:

    http://help.infragistics.com/NetAdvantage/ASPNET/2011.2/CLR4.0/?page=Web_WebDataGrid_WebDataGrid.html

    Additional samples demonstrating the features of these grids can be found at:
    http://samples.infragistics.com/aspnet/

    Hope this helps.

Reply Children