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
130
WinGrid Banding
posted

 I have been trying to effectively add another band(1) to the UltraWinGrid programmaticlly.

Understanding I need to use a datasource, which I am using a datatable that is programmaticlly built.

I also viewed several postings and web searches that focus on UltraWebGrids. Once in particular : http://forums.infragistics.com/forums/p/12527/46572.aspx, just states what you can use and what you have to use.

I am looking for a simple example on how to add an expandable band.

Thanks in advance.

Brant.
Parents
No Data
Reply
  • 230
    posted

    'Create the root band

    Me.UltraDataSource1.Band.Key = "RootBand"
    Me.UltraDataSource1.Band.Columns.Add("Column Name", GetType(String))

    'Set the row count

    Me.UltraDataSource1.Rows.SetCount(1)

    'set the row number and populate the column

    row = Me.UltraDataSource1.Rows(0)
    row("Column Name") = "Some text here"

     

    'To Create a child band of the root band

    'Declare the child band and add columns

    Dim childBand As UltraDataBand = _
     Me.UltraDataSource1.Band.ChildBands.Add("CHILDBAND1KEY")

    childBand.Columns.Add("Column Name", GetType(String))

    'Declare the childRows, set row count, and populate columns

    Dim childRows As UltraDataRowsCollection = row.GetChildRows("CHILDBAND1KEY")
    childRows.SetCount(1)
    childRows(0)("Column Name") = "Some text here"

     


    'To Create a child band of the previous child band "childband"

    'Declare childband2, and add columns to childband2

    Dim childBand2 As UltraDataBand = _
     Me.UltraDataSource1.Band.ChildBands(0).ChildBands.Add("CHILDBAND2KEY")

    childBand2.Columns.Add("Column Name", GetType(String))

    'Declare ChildRows2 as a child of childRows, set row count, and populate columns

    Dim childRows2 As UltraDataRowsCollection = childRows(0).GetChildRows("CHILDBAND2KEY")
    childRows2.SetCount(1)
    childRows2(0)("Column Name") = "Some text here"

     


    'To Create a child band of the previous child band "childBand2"

    'Declare childband3, and add columns to childband3

    Dim childBand3 As UltraDataBand = _
     Me.UltraDataSource1.Band.ChildBands(0).ChildBands(0).ChildBands.Add("CHILDBAND3KEY")

    childBand3.Columns.Add("Column Name", GetType(String))

    'Declare ChildRows3 as a child of childRows2, set row count, and populate columns

    Dim childRows3 As UltraDataRowsCollection = childRows2(0).GetChildRows("CHILDBAND3KEY")
    childRows3.SetCount(1)
    childRows3(0)("Balloon") = "Some text here"


    You should start to get the pattern by now.  For each level down, you add a ChildBands(0)
    when you declare the childband.

    ' Then, just bind it to the Grid

    Me.UltraGrid1.DataSource = Me.UltraDataSource1

    Hope this helps.

     

Children