This is a migrated thread and some comments may be shown as answers.

GridView filtering exception

3 Answers 89 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christ
Top achievements
Rank 2
Christ asked on 23 Sep 2011, 07:57 AM
Hi all,

I have a grid view with multiple columns, on which I want to apply filtering. When I use multiple filters, I get an exception of type

ArgumentOutOfRangeException
Index must be within the bounds of the List.
Parameter name: index

I can't find the cause of this, so does anybody have an idea of what's going wrong here? Grouping is also applied to the gridview (but I also tested without grouping with same exception as result).

The complete callstack is this:  
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.Insert(Int32 index, T item)
   at System.Collections.ObjectModel.Collection`1.InsertItem(Int32 index, T item)
   at Telerik.Collections.Generic.NotifyCollection`1.InsertItem(Int32 index, T item)
   at Telerik.WinControls.UI.GridViewFilterDescriptorCollection.InsertItem(Int32 index, FilterDescriptor item)
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at Telerik.WinControls.UI.GridViewDataColumn.SetFilterDescriptor(FilterDescriptor value)
   at Telerik.WinControls.UI.RadListFilterMenuProvider.SetFilterDesriptor(GridViewDataColumn dataColumn, FilterDescriptor descriptor)
   at Telerik.WinControls.UI.RadListFilterMenuProvider.SetFilterDescriptor(FilterDescriptor descriptor)
   at Telerik.WinControls.UI.RadListFilterMenuProvider.ButtonOK_Click(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at Telerik.WinControls.RadItem.OnClick(EventArgs e)
   at Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e)
   at Telerik.WinControls.RadItem.DoClick(EventArgs e)
   at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e)
   at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
   at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at Telerik.WinControls.RadControl.WndProc(Message& m)
   at Telerik.WinControls.UI.RadPopupControlBase.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at WinWorkFlow.Program.Main(String[] args) in C:\Data\TeamProjects\devc#2009\MuseumWorkflow.root\MuseumWorkflow\WinWorkFlow\Program.cs:line 19

Thanks,
Christ

3 Answers, 1 is accepted

Sort by
0
Christ
Top achievements
Rank 2
answered on 27 Sep 2011, 09:27 AM
Hi all,

Anyone has some clue about this issue? Customer is waiting for a solution...

Thanks,
Christ
0
Christ
Top achievements
Rank 2
answered on 27 Sep 2011, 10:56 AM
Hi all,

Found the solution,simple programming error (Clearing the FilterDescriptors list in the FilterChanging event is not a good idea).

Regards,
Chrsit
0
Julian Benkov
Telerik team
answered on 28 Sep 2011, 10:04 AM
Hi Christ,

I am glad to hear that you have solved your issue. You are absolutely right it is not a good practise to clear FilterDescriptor collection in the FilterChanging event.

Do not hesitate to contact us if you have further questions or issues.

All the best,
Julian Benkov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Christ
Top achievements
Rank 2
Answers by
Christ
Top achievements
Rank 2
Julian Benkov
Telerik team
Share this question
or