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 = dsDatawhdg1.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
Hello Andreas,Please let me know if you have any further questions regarding this issue.
Hello Nikifor,
only WebHierarchicalDataGrid1.GridView.ClearDataSource() is necessary.
Thank you very much.
Hello Andreas,Sorry for my fast but not correct response. Those two methods should be invoked through the gridview of the WHDG like:
WebHierarchicalDataGrid1.GridView.ClearDataSource();
WebHierarchicalDataGrid1.GridView.RequestFullAsyncRender();
Please take a look at:http://help.infragistics.com/NetAdvantage/ASPNET/2011.1/CLR4.0?page=Infragistics4.Web.v11.1~Infragistics.Web.UI.GridControls.WebDataGrid~RequestFullAsyncRender.html
http://help.infragistics.com/NetAdvantage/ASPNET/2011.1/CLR4.0?page=Infragistics4.Web.v11.1~Infragistics.Web.UI.GridControls.WebDataGrid~ClearDataSource.html
As no .ClearDataSource() exists (which does the job for WebDataGrid) it seems the only way to make the WebHierarchicalDataGrid aware of the datastructure change is to set EnableViewstate="false", with all disadvantages this has.
is it possible that those methods are only available for WebDataGrid, not for WebHierarchicalDataGrid (at least not in 2011.1)?Regards,Andreas