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
380
Changed column count in datasource not reflected in grid after databind
posted

Version: 11.1.20111.2238

I'm using a WebHierarchicalDataGrid with a dataset as datasource. Depending on user selectable options the number of columns in the datasource may vary.
The issue is that after rebinding the dataset in code-behind the columns shown in the grid stay the same even if the number of columns in the datasource has changed.
So for instance if first the datasource contains 14 columns (so the grid shows 14) and is then rebound containing 15 columns, the grid continues to show only the 14 created on the first .databind(). The data is updated, but the columns are not.

My expectation was that Bands.Clear() would reinitialize the grid structure and on .databind() a new one would be auto-created.

Im Binding the dataset like this:

whdg1.Bands.Clear()
whdg1.Rows.Clear()
whdg1.Columns.Clear()
whdg1.DataSource = dsData
whdg1.DataBind()

Grid definition:
<ig:WebHierarchicalDataGrid ID="whdg1" runat="server" Height="600px" Width="100%" EnableDataViewState="true" EnableAjax="false"
InitialExpandDepth="-1" InitialDataBindDepth="-1" AutoGenerateColumns="true" AutoGenerateBands="true">
</ig:WebHierarchicalDataGrid>

Any ideas how to force the grid to show the new data structure if it has changed in the datasource?

Thanks,
Andreas