Hi,
I have a simple page with two AJAX UpdatePanels. In the top panel I have a ThinkGeo Map and in the bottom panel I have an UltrWebGrid.
Selecting some features on the map populates a DataTable which is used as the Datasource for the Grid.
I group the Grid by the type of feature using:
protected void SelectionDetailsGrid_DataBound(object sender, EventArgs ){
if (col.Header.Caption.ToUpper() == "TERRITORY"){
col.IsGroupByColumn = true;}
}
All of this works fine on the first selection and the grid behaves as expected. However, on subsequent selections, the exception below is thrown. Just to be sure, I did apply the following code (based on suggestions of an earlier post) before rebinding my grid to the DataTable on subsequent selection.
gv.ResetBands()
gv.ResetRows()
gv.ResetColumns().
This made no difference and I still get this error.
System.InvalidOperationException was unhandled by user code Message="Failed to compare two elements in the array." Source="mscorlib" StackTrace: at eMap.MainApp.Map1_TrackShapeFinished1(Object sender, EventArgs e) in C:\DEV\T5\T5.eMap\Trunk\eMap\MainApp.aspx.cs:line 211 at ThinkGeo.MapSuite.WebEdition.Map.OnTrackShapeFinished() at ThinkGeo.MapSuite.WebEdition.Map.x3296715cc7992de2(String x055cc4f8164153bb) 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) InnerException: System.NullReferenceException Message="Object reference not set to an instance of an object." Source="Infragistics35.WebUI.UltraWebGrid.v8.3" StackTrace: at Infragistics.WebUI.UltraWebGrid.UltraGridLayout.GroupByColumnComparer.Compare(Object x, Object y) at System.Array.BinarySearch(Array array, Int32 index, Int32 length, Object value, IComparer comparer) InnerException:
Hi Namibian,
Can you supply a code sample or create a case with Developer Support.
Magued
I am seeing this issue as well. We recently switched from Infragistics20.WebUI.UltraWebGrid.v8.2 to Infragistics35.WebUI.UltraWebGrid.v8.3 and that's the first time I saw the error (I checked back through recent changes in our code and nothing seems to be present other than the IG revision change).
As for a code snippet, previously, I had the following in an ajax clicked event
protected [click event from aspx](object sender, eventargs e) {
grid.Columns.Clear();grid.DataSource = GetDataSource();grid.DataBind(); <-- error points here (error attached at bottom)
where GetDataSource() performs a lookup and "filters" out columns based on the criteria related to the aspx click event.
I have subsequently tried adding the following prior to the datasource change with no success.
grid.ResetBands();grid.ResetColumns();grid.ResetRows();
We are using the OutlookGroupBy and its a rather customized grid. Any thoughts you might have would be greatly appreciated,
Adam
Error:
[NullReferenceException: Object reference not set to an instance of an object.] Infragistics.WebUI.UltraWebGrid.GroupByColumnComparer.Compare(Object x, Object y) +150 System.Array.BinarySearch(Array array, Int32 index, Int32 length, Object value, IComparer comparer) +215[InvalidOperationException: Failed to compare two elements in the array.] System.Array.BinarySearch(Array array, Int32 index, Int32 length, Object value, IComparer comparer) +276 System.Collections.SortedList.IndexOfKey(Object key) +28 System.Collections.SortedList.get_Item(Object key) +12 Infragistics.WebUI.UltraWebGrid.UltraGridLayout.RegisterGroupByColumn(UltraGridColumn groupedColumn) +23 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.GroupRows(RowsCollection rows, UltraGridColumn column) +263 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.SortGroupRows(RowsCollection rows) +330 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.PerformGroupRows() +216 Infragistics.WebUI.UltraWebGrid.DBBinding.BindList(IEnumerable datasource) +1336 Infragistics.WebUI.UltraWebGrid.DBBinding.DataBind(Object dataSource, String dataMember) +1089 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.DataBind() +397
This works for me:
before binding:
uwgReport.ExpandAll(false);
foreach (UltraGridColumn col in uwgReport.Columns)
{
col.IsGroupByColumn = false; //mandatory because of infragistics bug
uwgReport.Columns.Clear();
manu
Hi Adam,
I am seeing the same issue as you did. Below is the code where I am getting the error. public void RebindGrid(bool refreshData, bool resetGrid) { this.DataSet = null;this.TheGrid.Clear(); this.TheGrid.Bands.Clear();this.TheGrid.DataBind(); -- I get the same error you mentioned in your post here}
When I try to Rebind the grid after grouping on two columns I am getting this error. Before Rebinding the grid I am doing grid.Clear(); I tried adding the following code before the Databind() but was of no use.
The ViewType is set to OutlookGroupBy and it is customized as well. If you have solved this issue would you please let me know how you did it. I would appreciate it.
I would be very thankful to anybody who could help to solve this issue. Thanks.
-Bhargavi R.
[NullReferenceException: Object reference not set to an instance of an object.] Infragistics.WebUI.UltraWebGrid.GroupByColumnComparer.Compare(Object x, Object y) +252 System.Array.BinarySearch(Array array, Int32 index, Int32 length, Object value, IComparer comparer) +229
[InvalidOperationException: Failed to compare two elements in the array.] System.Array.BinarySearch(Array array, Int32 index, Int32 length, Object value, IComparer comparer) +289 System.Collections.SortedList.IndexOfKey(Object key) +31 System.Collections.SortedList.get_Item(Object key) +15 Infragistics.WebUI.UltraWebGrid.UltraGridLayout.RegisterGroupByColumn(UltraGridColumn groupedColumn) +65 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.GroupRows(RowsCollection rows, UltraGridColumn column) +410 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.SortGroupRows(RowsCollection rows) +449 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.PerformGroupRows() +323 Infragistics.WebUI.UltraWebGrid.DBBinding.BindList(IEnumerable datasource) +3711 Infragistics.WebUI.UltraWebGrid.DBBinding.DataBind(Object dataSource, String dataMember) +2019 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.DataBind() +683
Thank you,Bhargavi R.
Hello,
Indeed, the only time I have seen this before is in a forum post where the customer managed to deal with this problem by calling
piror to rebinding the grid. The forum is available here:
http://forums.infragistics.com/forums/p/12234/45784.aspx#45784
If this does not work for you, then maybe the only way is to create a support ticket with our official Developer Support channels available here:
http://es.infragistics.com/Support/default.aspx