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
655
Child row not expanding
posted

Hi,

I am trying to bind the WebHierarchicalDataGrid in code and have successfully managed to retrieve the initial parent data.  When I click on the Expand Row arrow the grid posts back but the row does not expand to show the child data.  Can anyone see hwy this might be happening from the code below.

Thanks

Luke

 

 

 

 

 

 

 

 

 

 

 

Protected

 

 

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

 

Dim MainDS As New WebHierarchicalDataSource

 

 

Dim ProductView As New Infragistics.Web.UI.DataSourceControls.DataView

ProductView.ID =

 

"ProductDataView"

ProductView.DataSource = sdsShowAllProducts

MainDS.DataViews.Add(ProductView)

 

 

Dim DocumentsView As New Infragistics.Web.UI.DataSourceControls.DataView

DocumentsView.ID =

 

"DocumentDataView"

DocumentsView.DataSource = sdsShowAllDocuments

MainDS.DataViews.Add(DocumentsView)

 

 

Dim ProductNoRelation As New Infragistics.Web.UI.DataSourceControls.DataRelation(ProductView.ID, "ProductNo", DocumentsView.ID, "ProductNo")

MainDS.DataRelations.Add(ProductNoRelation)

CAPGrid.DataSource = MainDS

 

 

If Not Page.IsPostBack Then

AddParentBand(CAPGrid)

AddChildBand(CAPGrid)

 

 

End If

 

 

End Sub

 

 

Private Sub AddParentBand(ByRef Grid As Infragistics.Web.UI.GridControls.WebHierarchicalDataGrid)

 

 

'the grid is the root band

Grid.AutoGenerateBands =

 

False

Grid.Key =

 

"ProductDataView"

Grid.DataKeyFields =

 

"ProductNo"

AddBandColumn(Grid,

 

"ProductNo", "", True, True)

AddBandColumn(Grid,

 

"Product Name", "", False, True)

 

 

End Sub

Private

 

 

Sub AddChildBand(ByRef Grid As Infragistics.Web.UI.GridControls.WebHierarchicalDataGrid)

 

 

Dim ChildBand As New Infragistics.Web.UI.GridControls.Band

 

 

ChildBand.Key = "DocumentDataView"

ChildBand.DataKeyFields =

 

"ProductNo"

Grid.Bands.Add(ChildBand)

AddBandColumn(Grid,

 

"ProductNo", "", True, False)

AddBandColumn(Grid,

 

"Doc1", "", False, False)

 

 

End Sub

Private

 

 

Sub AddBandColumn(ByRef Grid As Infragistics.Web.UI.GridControls.WebHierarchicalDataGrid, ByVal DataField As String, ByVal Caption As String, ByVal Hidden As Boolean, ByVal Parent As Boolean)

 

 

Dim boundfld1 As New BoundDataField(True)

 

 

boundfld1.Key = DataField

boundfld1.DataFieldName = DataField

boundfld1.Hidden = Hidden

boundfld1.Header.Text = Caption

 

 

If Parent Then

Grid.Columns.Add(boundfld1)

 

 

Else

Grid.Bands(0).Columns.Add(boundfld1)

 

 

End If

 

 

End Sub