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
1910
How to create more than one multi-column header
posted

I know how to create one multi-column header, but I cannot figure out how to create a 2nd multi-column header. I don't mean a 2nd row. I mean a 2nd multi-column header on the same row as the 1st multi-column header. The code I have that creates the 1st one is:

Dim colHead As Infragistics.WebUI.UltraWebGrid.ColumnHeader
Dim i As Integer
For i = 0 To
e.Layout.Bands(0).HeaderLayout.Count - 1
colHead = e.Layout.Bands(0).HeaderLayout(i)
colHead.RowLayoutColumnInfo.OriginY = 1
Next

' The boolean parameter inserts this header into viewstate, so that the grid will maintain it over a postback if it is not recreated.

Dim ch As New Infragistics.WebUI.UltraWebGrid.ColumnHeader(True)

' The caption to include for the unbound column
ch.Caption = "Par Favorable"
' Set the origin of the element. This will set it up on the first column of the header layout.
ch.RowLayoutColumnInfo.OriginX = 5
' This will set it on the first row of the HeaderLayout object. The columns created by the control are all on the zeroth row by default.
ch.RowLayoutColumnInfo.OriginY = 0
' Add the newly created Header object to the HeaderLayout object
e.Layout.Bands(0).HeaderLayout.Add(ch)
' Expand the new column header to cover all columns.
ch.RowLayoutColumnInfo.SpanX = 3
'End of adding a column header that spans across all columns

Parents
  • 49378
    posted

    Hi algunderson,

    Thank you for posting in the community.

    You can add multiple custom headers in UltraWebGrid - only the OriginX, OriginY and span values need to be modified as needed, for instance:

    Code Snippet
    1. //second custom header
    2. ColumnHeader ch1 = new ColumnHeader(true);
    3.  
    4. ch1.Caption = "Custom caption";
    5.  
    6. //set the x coordinate of this header relative to the number of columns
    7. ch1.RowLayoutColumnInfo.OriginX = 3;
    8.  
    9. //set the header row on which the header is to appear
    10. ch1.RowLayoutColumnInfo.OriginY = 0;
    11. // Add the newly created Header object to the HeaderLayout object
    12. e.Layout.Bands[0].HeaderLayout.Add(ch1);
    13.  
    14. // Expand the new column header to cover two columns.
    15. ch1.RowLayoutColumnInfo.SpanX = 2;

    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:

    https://help.infragistics.com/Doc/ASPNET/2011.2/CLR4.0/?page=Web_WebDataGrid_WebDataGrid.html

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

    Hope this helps.

Reply Children