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
589
Set column header and width
posted

Hi,

In the classic ultraWebGrid control, the following code (in code behind, Runtime, VB.NET language) changes the column header and  width

UltraWebGrid.Columns(0).Header.Caption = "Column Name1"

UltraWebGrid.Columns(0).Width = New Unit("32px")

How to do the above change for  the Webdatagrid in runtime?

Thanks, Karthik

Parents
No Data
Reply
  • 29417
    Offline posted

    Hello Karthik ,

     

    Thank you for posting in our forum.

     

    The WebDataGrid also has a columns collection. You can get a specific column by index in the same way :grid.Columns(0)

    To set the header text you can get the header and set the text property : grid.Columns(0).Header.Text=”Some text”

    The column also has a Width property you can set in the same manner : grid.Columns(0).Width=New Unit(“32px”)

     

    Is perhaps your columns collection AutoGenerated? If that’s the case then your columns collection would be empty.

    If that’s the case you could either set the AutoGenerateColumns property of the grid to false , create the columns runtime and add them to the columns collection or if you need to leave them autogenerated get a reference to them from the items in the rows for example: grid.Rows(0).Item(0).Column.

     

    Let me know if you have any questions or concerns.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer II

    Infragistics, Inc.

    http://ko.infragistics.com/support

     

     

Children