Hi all,
I've been stuck for a while trying to setup our WHDG. We have a dynamic, changing, dataset object coming back from our databases. This can have N relationships and tables in it. We must create the bands manually so that we can hide columns and format the display.
Note: If I set the grid to auto create the bands, it works fine but the display is no good for our needs.
However, if I try to create a band for each dataTable in the set then the 2nd level + band I create are not used.
Also, if I create the bands manually but leave AutoGenerateBands="True" then the 2nd level band has no formatting.
Is there some way I can view the auto generated bands in code? If so then maybe I could see what was wrong with my setup.
This is the function I used to setup the bands:
Protected Overrides Sub OnInit(ByVal e As EventArgs)
Dim i As Integer = 1 ' skip root band/table (this is already setup in the grid)
While i < Me.WHDG1.DataSource.Tables.Count
Dim band As New Infragistics.Web.UI.GridControls.Band
Dim table As New DataTable
table = Me.WHDG1.DataSource.Tables(i)
Me.WHDG1.Bands.Add(band)
band.DataMember = table.TableName
band.Key = table.TableName
band.DataKeyFields = "Autoid"
band.ShowHeader = False
band.AutoGenerateColumns = False
addDataField("Sel", "Sel", "20", False, "columnClassSel", table, band)
addDataField("Sel1", "Sel", "20", False, "columnClassSel", table, band)
addDataField("Sel2", "Sel", "20", False, "columnClassSel", table, band)
addDataField("Sel3", "Sel", "20", False, "columnClassSel", table, band)
addDataField("Sel4", "Sel", "20", False, "columnClassSel", table, band)
addDataField("Sel5", "Sel", "20", False, "columnClassSel", table, band)
addDataField("Sel6", "Sel", "20", False, "columnClassSel", table, band)
addDataField("display", "display", "", False, "", table, band)
addDataField("Available", "Available", "70", False, "columnClassAvailable", table, band)
addDataField("name", "name", "", True, "", table, band)
addDataField("parenttable", "parenttable", "", True, "", table, band)
addDataField("parentkey", "parentkey", "", True, "", table, band)
addDataField("childtable", "childtable", "", True, "", table, band)
addDataField("level", "level", "", True, "", table, band)
addDataField("filter", "filter", "", True, "", table, band)
addDataField("incex", "incex", "", True, "", table, band)
addDataField("tbl", "tbl", "", True, "", table, band)
addDataField("bandkey", "bandkey", "", True, "", table, band)
i = i + 1
End While
Private Sub addDataField(ByVal fieldName As String, ByVal key As String, ByVal width As String, ByVal hidden As Boolean, ByVal cssClass As String, ByRef table As DataTable, ByRef band As Infragistics.Web.UI.GridControls.Band)
If table.Columns.Contains(fieldName) Then
Dim dataField As Infragistics.Web.UI.GridControls.BoundDataField = New Infragistics.Web.UI.GridControls.BoundDataField
dataField.DataFieldName = fieldName
dataField.Key = fieldName
dataField.Hidden = hidden
dataField.CssClass = cssClass
If Not width = "" Then
dataField.Width = width
End If
band.Columns.Add(dataField)
End Sub
Hello,
Let me know if you have any questions with this matter.
Thanks.
Hi there, thanks a lot for helping us out.
This example is very useful and I've started to put it in place.
I've fallen at the first hurdle I'm afraid as I seen unable to set the newly created rows as IsEmptyParent
The method the event fires in VB requires the following definition:
Protected Sub whdg1_InitializeRow(ByVal sender As Object, ByVal e As RowEventArgs)
If isChild = False Then
DirectCast(e.Row, ContainerGridRecord).IsEmptyParent = True
This looks incorrect as the values are passed in by Value and not by reference?
Please see attached solution that I'm using to test this problem. It's the code you supplied converted into VB.
My client must use VB as the rest of the application/page is coded as such. I'm using infragistics 10.1
If this is a bug, is this something that is fixed in 10.2?