I have a ultrwebgrid which I bind data to from a postback. After the grid is loaded I perform a sort on one of the columns and then perform another postback to load the grid again and receive a NullReferece Exception from Infragistics.WebUI.UltraWebGrid.RowsCollection Sort()
I tried using the .ResetColumns() method in the _InitializeDataSource event however even though I have records in my dataset, it seems to bind to the grid(based on the events that are fired), it's empty.
If I then perform an additional postback, the data is loaded into the grid.
I have the same problem.if you not reset columns before binding,there is no error,but the style of columns will lost . just like "align"
The easiest method I found was to add another grid specifically for exporting data from. Then the original grid which has sorting, ajax, paging, etc.. retains those features without me having to reset anything prior to export.
on export I just bind the data to grid # 2 and I dont get various exceptions as with grid # 1.
It's a kludge but seems to work for now until I find a better approach.
R
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] Infragistics.WebUI.UltraWebGrid.RowsCollection.Sort() +797 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.SortGroupRows(RowsCollection rows) +148 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.PerformGroupRows() +216 Infragistics.WebUI.UltraWebGrid.DBBinding.BindList(IEnumerable datasource) +2005 Infragistics.WebUI.UltraWebGrid.DBBinding.DataBind(Object dataSource, String dataMember) +1333 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.DataBind() +405 Infragistics.WebUI.UltraWebGrid.StateChangeProcessor.ProcessSortedColumns(StateChange stateChange, UltraGridColumn column) +4195 Infragistics.WebUI.UltraWebGrid.StateChangeProcessor.ProcessChanges() +3112 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.ProcessChanges(StateChanges stateChanges, Boolean fireEvents) +516 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.LoadPostData(String postDataKey, NameValueCollection values) +6073 System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +353 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1194
Hey Ivan,
The difference is that I am letting the IntializeDataSource event load the grid. I am not doing that from the Page_load event.
Robert