I have a simple UltraWebGrid that displays the search results based on several criteria. It is working fine until the user clicks on a header to sort the grid. The grid performed the sort just fine; however, when the user enter new search criteria, an NullReferenceException is generated when calling DataBind on the grid.
uwgResult.DataSource = aDataTableuwgResult.DataBind <- This call will generate an exception only after user clicks on any header to sort
Could someone tell me what should be the "correct" way of data binding a new data source?
Thanks.
Thanks Darrell,
Calling Bands(0).SortedColumns.Clear() on the grid solves the problem! Actually, I tried to do it manually by getting an enumerator and setting them 1 by 1, that did not work either...
I arm not sure if I am running the latest hotfix though.
I can finally move on to something else.
I guess you could try clearing the SortedColumns collection (I thought that would clear with the null databind).
If that doesn't work, your best bet is to contact Developer Support, preferably with a sample that can reproduce the issue.
I assume you are using the latest hotfix, there was an old issue that seemed related but its quite old and was resolved some time ago.
I did try that before, same thing happened. I have verified that the new data set has the correct data in it.....
And here is the stack trace when I called DataBind
at Infragistics.WebUI.UltraWebGrid.RowsCollection.Sort() at Infragistics.WebUI.UltraWebGrid.UltraWebGrid.SortGroupRows(RowsCollection rows) at Infragistics.WebUI.UltraWebGrid.UltraWebGrid.PerformGroupRows() at Infragistics.WebUI.UltraWebGrid.DBBinding.BindList(IEnumerable datasource) at Infragistics.WebUI.UltraWebGrid.DBBinding.DataBind(Object dataSource, String dataMember) at Infragistics.WebUI.UltraWebGrid.UltraWebGrid.DataBind() at Results_DailyResults.BindData(DataSet& myDataSet) at Results_DailyResults.SubmitButtonClicked at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
If I use UpdatePanel, I got the error page, but if I use AsyncRefreshPanel, the page post back due to that error as if nothing happened...
One thing that might help would be set the DataSource = null (nothing in VB), calling DataBind() and then binding the new datasource. But without being able to see what might be causing the issue, thats about all I can suggest.