Hi, I seem to have the following problem while using the WHDG.
----------------------------------------------------------------------------------------
CODE
<asp:UpdatePanel ID="async_RefreshKlasses" runat="server" meta:resourcekey="async_RefreshKlassesResource1"> <ContentTemplate> <ig:WebHierarchicalDataGrid ID="uwgKlasse" runat="server" DataSourceID="dsKlasse" meta:resourcekey="uwgKlasse" AutoGenerateBands="false" AutoGenerateColumns="false" /> <asp:HiddenField runat="server" ID="hdnKlasseID" /> <asp:HiddenField runat="server" ID="hdnContentRefresh" Value="False" /> </ContentTemplate> </asp:UpdatePanel> <ig:WebHierarchicalDataSource ID="dsKlasse" runat="server"> <DataViews> <ig:DataView ID="ds_Klasse" DataSourceID="odsKlasse" DataMember="DefaultView" /> <ig:DataView ID="ds_Vhc" DataSourceID="odsVh" DataMember="DefaultView" /> </DataViews> <DataRelations> <ig:DataRelation ParentColumns="KlsID" ParentDataViewID="ds_Klasse" ChildColumns="VhcKlsID" ChildDataViewID="ds_Vhc" /> </DataRelations> </ig:WebHierarchicalDataSource>
- objectdatasources are correct -
I create the layout of my grid once, in the page_init
CODE BEHIND
Dim col As Infragistics.Web.UI.GridControls.BoundDataField Dim b As Infragistics.Web.UI.GridControls.Band With uwgKlasse .DataKeyFields = "KlsID" .InitialDataBindDepth = 0 .Width = 970 SetBehaviors() 'This sets sorting, selection, blah blah End With col = New Infragistics.Web.UI.GridControls.BoundDataField With col .Key = "KlsID" .DataFieldName = .Key .Hidden = True 'THE LINE!! uwgKlasse.Columns.Add(col) End With col = New Infragistics.Web.UI.GridControls.BoundDataField With col .Key = "KlsName" .DataFieldName = .Key .Header.Text = GetLocalResourceObject("DESCR") .Width = 150 uwgKlasse.Columns.Add(col) End With col = New Infragistics.Web.UI.GridControls.BoundDataField With col .Key = "KlsPrice" .DataFieldName = .Key .Header.Text = GetLocalResourceObject("PRICE") .Width = 80 .CssClass = "grid-Cell-right" .Header.CssClass = "grid-Header-right" .DataFormatString = "{0:C2}" uwgKlasse.Columns.Add(col) End With
'------ Child data ------ b = New Infragistics.Web.UI.GridControls.Band() With b .DataMember = "ds_Vhc" .AutoGenerateColumns = False .DataKeyFields = "VhcID" .Key = "bandVhc" uwgKlasse.Bands.Add(b) uwgKlasse.RefreshBehaviors() End With col = New Infragistics.Web.UI.GridControls.BoundDataField With col .Key = "VhcDescr" .DataFieldName = "VhcDescr" .Header.Text = GetLocalResourceObject("DESCR") .Width = 150 uwgKlasse.Bands("bandVhc").Columns.Add(col) End With
This all works, I get the main data, but I don't get the child band.
IF I remove "the line" .Hidden = true on my KlsID, the band appears.
What am I doing wrong?
This was resolved by using a layout style.. Probably a bad definition in the first.
Hi Razieltje,
I'm glad you solved your issue.
Let me know if you have any other questions.