Hi All,
I have a WHDG bound to a WebHierarchicalDataSource with a list of custom entities. The design on the grid is as follows:
<ig:WebHierarchicalDataGrid ID="uxDynamicContentsGrid" runat="server" Width="550px" Height="750px"
AutoGenerateBands="False" AutoGenerateColumns="False" EnableAJAX="false"
DataMember="DCDetails" Key="DCDetails" EnableDataViewState="false"
DataKeyFields="DynamicContentViewId"
GroupingSettings-ShowRemoveButton="False" StyleSetName="Office2007Silver"
GroupingSettings-GroupedRowTextMask="{1}" ShowHeader="False">
<EmptyRowsTemplate>There are no groups/ dynamic content assigned to the selected view.</EmptyRowsTemplate>
<GroupingSettings EnableColumnGrouping="True" GroupAreaVisibility="Hidden" ShowRemoveButton="False">
<RemoveButton AltText="Ungroup Column" />
</GroupingSettings>
<Behaviors>
<ig:Sorting Enabled="false"></ig:Sorting>
<ig:Activation>
</ig:Activation>
<ig:EditingCore AutoCRUD="False">
<ig:CellEditing>
<ColumnSettings>
<ig:EditingColumnSetting ColumnKey="DynamicContentName" ReadOnly="true" />
</ColumnSettings>
</ig:CellEditing>
<ig:RowDeleting />
</Behaviors>
</ig:EditingCore>
The grid is bound on every postback (to resolve certain other issues we have). The loading of the grid is as follows:
uxDynamicContentsGrid.Rows.Clear()
uxDynamicContentsGrid.GroupingSettings.EnableColumnGrouping = DefaultableBoolean.False
uxDynamicContentsGrid.GroupingSettings.GroupedColumns.Clear()
uxDynamicContentsGrid.GroupingSettings.ColumnSettings.Clear()
uxDynamicContentsSource.DataRelations.Clear()
uxDynamicContentsSource.DataViews.Clear()
uxDynamicContentsGrid.DataSource = Nothing
uxDynamicContentsGrid.DataBind()
Dim viewId As Integer = uxViewDropDown.SelectedValue
If viewId > 0 Then
contents = entityManager.GetContentsByEntityIdAndViewId(EntityId, viewId)
Else
contents = entityManager.GetContentsByEntityId(EntityId)
End If
' Specify data views
Dim dv As New Infragistics.Web.UI.DataSourceControls.DataView
dv = New Infragistics.Web.UI.DataSourceControls.DataView
dv.ID = "DCDetails"
dv.DataSource = contents
' Add view to datasource
uxDynamicContentsSource.DataViews.Add(dv)
uxDynamicContentsGrid.GroupingSettings.EnableColumnGrouping = DefaultableBoolean.True
' A calculated property OrderedGroupName has been added which returns GroupOrder_ContentOrder_GroupName
Dim setting As New GridControls.ColumnGroupingSetting
setting.ColumnKey = "OrderedGroupName"
setting.GroupComparer = New GroupNameComparer()
uxDynamicContentsGrid.GroupingSettings.ColumnSettings.Add(setting)
uxDynamicContentsGrid.GroupingSettings.GroupedColumns.Add("OrderedGroupName")
uxDynamicContentsGrid.DataSource = uxDynamicContentsSource
THE ISSUE
1. When user selects an entity in WebDataTree, the details are populated in the grid (within a WebTab) with no grouping in a pre-defined order (as returned by the SQL query)
2. The user then selects a 'view' from a dropdown list and this reloads the grid based on the selection and groups the grid based on the value in a hidden column.
3. User selects another entity in the treeview. The details are populated in the grid correctly but the order is wrong. I have verified that the query retrieves the correct order. I have also verified that the contents of the DataView inside the WebHierarchicalDataSource is in the correct order. However, when DAtaBind is invoked and InitializeRow is called, it is done in an incorrect order.
I would appreciate it if someone could assist with this query as this is holding up our release.
Thanks!
Hi Tsanna,
I think this has solved the problem.
However, we now have a bigger problem when trying to avoid binding the grids on each postback by using EnableDataViewState="true". I will post a new question for this.
Appreciate your response.
Hello Insula Group Pty,
Based on the provided code, I assume that if you clear the datasource before the "uxDynamicContentsGrid.DataSource = uxDynamicContentsSource" line then this will reset everything applied to it before this databinding and the datasource will occur in its initial version. Please let me know if this helps.
Sincerely,
Tsanna
Hello Chris,
Thank you for posting in our forum!
I'm currently looking into this matter and will keep you posted of any available information. Please feel free to contact me with any updates or additional information regarding this scenario in the meantime.