Hi, I am new to using the HierarchicalDataGrid but am really liking it so far. I've gotten everything working pretty easily by using the samples as a guide, but I'm having one issue that I don't know how to resolve. I have two columns in both the main grid itself and in the single band that I've setup that use webdropdown editors for editing the data. I have bound the webdropdown editor to a datasource and set the TextField and ValueField properties accordingly.
When the grid displays, the columns in the main grid are correctly displaying the TextField string and not the underlying value and I can edit them using the webdropdown with no problem. However when I expand a row and open up the child band, the two columns are displaying the ValueField value and not the TextField value (in this case an integer). When I double click on the cell I do get the webdropdown editor and if I select a value and leave that cell, it then displays the TextField value instead of the ValueField like it's supposed to. So the problem just appears to be on the initial binding of the grid that it's not using the right field. I'm sure I am just missing something, but not sure what.
I have included a screenshot of what I'm talking about as well as snippets of both the control declaration in the code-front and the code in the code-behind.
Thanks for your help (this is an awesome control!)
Code-front code:
<!-- Role/Position Assignments grid --><ig:WebHierarchicalDataGrid ID="whdgAssignments" runat="server" Height="400px"Width="650px"InitialDataBindDepth="-1"AutoGenerateColumns="false"AutoGenerateBands="false"DataKeyFields="sysID"><Columns> <ig:BoundDataField DataFieldName="RoleName" Key="RoleName"></ig:BoundDataField> <ig:BoundDataField DataFieldName="InternalEnforcement" Key="InternalEnforcement" Header-Text="Internal"></ig:BoundDataField> <ig:BoundDataField DataFieldName="ExternalEnforcement" Key="ExternalEnforcement" Header-Text="External"></ig:BoundDataField></Columns><Bands> <ig:Band DataMember="positions" Key="positions" ShowHeader="false" ShowFooter="false" IsSelfReference="false" AutoGenerateColumns="false" DataKeyFields="sysID"> <Columns> <ig:BoundDataField DataFieldName="txtName" Key="txtName"></ig:BoundDataField> <ig:BoundDataField DataFieldName="InternalEnforcement" Key="InternalEnforcement"></ig:BoundDataField> <ig:BoundDataField DataFieldName="ExternalEnforcement" Key="ExternalEnforcement"></ig:BoundDataField> </Columns> <Behaviors> <ig:EditingCore> <Behaviors> <ig:CellEditing Enabled="true"> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="InternalEnforcement" EditorID="EnforcementEditor" /> <ig:EditingColumnSetting ColumnKey="ExternalEnforcement" EditorID="EnforcementEditor" /> </ColumnSettings> </ig:CellEditing> </Behaviors> </ig:EditingCore> </Behaviors> </ig:Band></Bands><EditorProviders> <ig:DropDownProvider ID="EnforcementEditor"> <EditorControl ID="EditorControl1" runat="server" DisplayMode="DropDownList" width="165"> <ClientEvents DropDownOpening="DropDownOpening" /> </EditorControl> </ig:DropDownProvider></EditorProviders><Behaviors> <ig:EditingCore> <Behaviors> <ig:CellEditing Enabled="true" EnableInheritance="true"> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="InternalEnforcement" EditorID="EnforcementEditor" /> <ig:EditingColumnSetting ColumnKey="ExternalEnforcement" EditorID="EnforcementEditor" /> </ColumnSettings> </ig:CellEditing> </Behaviors> </ig:EditingCore></Behaviors></ig:WebHierarchicalDataGrid>
Code-behind code
' setup the webdropdown editor and bind it's dataDim EnforcementEditor As WebDropDown = CType(whdgAssignments.EditorProviders("EnforcementEditor").GetEditor(), WebDropDown)EnforcementEditor.DataSource = _dvEnforcementsEnforcementEditor.TextField = "Name"EnforcementEditor.ValueField = "ID"EnforcementEditor.DataBind()
' get the data needed for the Hierarchical data source
' create the parent 'roles' dataviewDim roleView As New Infragistics.Web.UI.DataSourceControls.DataView()roleView.DataSource = DistrictApplicantRole.GetFormDistrictApplicantRoleEnforcements(DistrictSessionManager.DistrictId, DistrictFormID)roleView.ID = "roles"WebHierarchicalDataSource1.DataViews.Add(roleView)
' create the child 'positions' dataviewDim positionView As New Infragistics.Web.UI.DataSourceControls.DataView()positionView.DataSource = Position.GetFormPositionEnforcements(DistrictSessionManager.DistrictId, DistrictFormID)positionView.ID = "positions"WebHierarchicalDataSource1.DataViews.Add(positionView)
' create the data relationDim relation As New Infragistics.Web.UI.DataSourceControls.DataRelation()' specify the parent inforelation.ParentDataViewID = "roles"relation.ParentColumns = New String() {"sysID"}' specify the child inforelation.ChildDataViewID = "positions"relation.ChildColumns = New String() {"sysCoreDistrictApplicantRoleID"}' add the relation to the data sourceWebHierarchicalDataSource1.DataRelations.Add(relation)
' bind the gridwhdgAssignments.DataSource = WebHierarchicalDataSource1whdgAssignments.DataBind()
How do you bring the DropDownList Provider to the front? You cannot tell it is a dropdown until you click into a cell. Thanks.
I followed a little different approach, but am having the same problem. I am having the problem on both my parent and child bands though. Setting InitialDataBindDepth = 1 doesn't help. Thought I'd show what I had and if there isn't any help through the forum, I'll submit a support request.
It will show the ID in the column. When I click to get the dropdown to appear, I can then select the text. On close, the text will display.
<
EditorProviders>
<ig:DropDownProvider ID="EscalatorProvider">
<EditorControl ID="ddlEscalator" runat="server" DisplayMode="DropDownList" DataSourceID="dsrcEscalators" TextField="EscalatorName" ValueField="EscalatorID">
<Button AltText="" ToolTip="Select an escalator" />
<DropDownItemBinding TextField="EscalatorName" ValueField="EscalatorID"></DropDownItemBinding>
<ClientEvents ValueChanged="ddlEscalator_ValueChanged" />
</EditorControl></ig:DropDownProvider></EditorProviders><Behaviors>
<ig:EditingCore>
<Behaviors><ig:CellEditing Enabled="true">
<ColumnSettings>
<ig:EditingColumnSetting ColumnKey="Escalator" EditorID="EscalatorProvider" />
</ColumnSettings></ig:CellEditing></Behaviors>
</ig:EditingCore></Behaviors>
I couldn't tell from your setup if you are doing anything out of normal, you code and markup looks fine. Try setting the initialbinddepth to 1 and see if you get the correct value. If you are still having trouble, contact support so that we can dig further into the problem.
https://ko.infragistics.com/my-account/submit-support-request/
-Taz.