We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Custom filter gives exception when different data type entered

Thread ID:

Created:

Updated:

Platform:

Replies:

98154 Feb 9,2011 12:16 PM Feb 23,2011 10:59 PM Windows Forms 5
loading
Tags: Grouping
Grant Crofton
Asked On February 9, 2011 12:16 PM

We're using v4.401.0.51, with the grid bound to a generic list of custom objects.

When applying a customer filter to a column, if the wrong data type is entered, we get an exception.

For example, if the column holds an integer, and someone sets up a filter which checks for the value being equal to 'jim' (or even just a blank), we get the following exception:

Object must be of type Int32

The stack trace shows it's using Int32's CompareTo() method, but doesn't reveal anywhere obvious to add exception handling:

----------------------------------------------------------
System.ArgumentException: Object must be of type Int32.
at System.Int32.CompareTo(Object value)
at Syncfusion.Grouping.Internals.SortColumnComparer._Compare(Object x, Object y)
at Syncfusion.Grouping.FilterCondition.CompareRecord(Record record)
at Syncfusion.Grouping.RecordFilterDescriptor._CompareRecord(Record record)
at Syncfusion.Grouping.RecordFilterDescriptor.CompareRecord(Record record)
at Syncfusion.Grouping.RecordFilterDescriptorCollection.CompareRecord(Record record)
at Syncfusion.Grouping.Record.MeetsFilterCriteria()
at Syncfusion.Grouping.Record.GetCounter()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterEntry.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetCounterTotal()
at Syncfusion.Grouping.Internals.ElementTreeTable.get_VisibleCount()
at Syncfusion.Grouping.DetailsSection.GetVisibleCount()
at Syncfusion.Grouping.Section.GetCounter()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterEntry.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter start, ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost)
at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost)
at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(ITreeTableCounter searchPosition, Int32 counterKind, Boolean leftMost)
at Syncfusion.Grouping.Internals.ElementHelper.GetEntryAtCounterPosition(Element el, ITreeTableCounter counter)
at Syncfusion.Grouping.Internals.ElementHelper.__FindElement(Table _table, ITreeTableCounter index, Type t, Boolean stepInNestedTables)
at Syncfusion.Grouping.Internals.ElementHelper.FindElement(Table _table, ITreeTableCounter index, Boolean stepInNestedTables)
at Syncfusion.Grouping.RuntimeElementsInTableCollection.get_Item(Int32 index)
at Syncfusion.Grouping.RuntimeElementsInTableCollectionEnumerator.Reset()
at Syncfusion.Grouping.RuntimeElementsInTableCollectionEnumerator..ctor(RuntimeElementsInTableCollection collection)
at Syncfusion.Grouping.RuntimeElementsInTableCollection.GetEnumerator()
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.InternalGetFrozenRows()
at Syncfusion.Windows.Forms.Grid.GridControlBase.GetVScrollPixelMinimum()
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.PointToNestedDisplayElement(Point ptClient)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.OnCellTipsMouseMove(MouseEventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at Syncfusion.Windows.Forms.ScrollControl.WndProc(Message& msg)
at Syncfusion.Windows.Forms.Grid.GridControlBase.WndProc(Message& msg)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
----------------------------------------------------------

Is there a way to prevent or catch this exception?

Thanks,
Grant


Mahendran [Syncfusion]
Replied On February 13, 2011 10:43 PM

Hi Grant,

Thanks for your interest in Syncfusion products.

We have checked with your query.The stated exceptions will be resolved in our latest versions upto V 8.x.
Please migrate to our new version.Probably this will vanish your stated exceptions.

Please let me know if you have any concerns.

Regards
R.Mahendran



Grant Crofton
Replied On February 14, 2011 04:41 AM

Hi Mahendran, unfortunately upgrading isn't an option at the moment. Do you know if there's a workaround for this, for example an exception handler somewhere that we could catch it?

Thanks,
Grant


Nirmal Raja [Syncfusion]
Replied On February 20, 2011 10:54 PM

Hi Grant,

We regret for the inconvenience caused.

In both the versions we tried with several samples and unable to reproduce the issue in our side. Please provide us a sample that reproduce the issue, which would be helpful for us to have further analysis.

Let me know if you have any concern.

Regards,
Nirmal


Grant Crofton
Replied On February 21, 2011 09:12 AM

It's Ok, we've gotten around it by wrapping everything which will be displayed in the grid in our own generic type, which includes an overloaded CompareTo() with an exception handler. Something like:

Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo

Try
Return _value.CompareTo(CType(obj, Wrapper(Of T))._value)
Catch ex As Exception
Return 1
End Try
End Function


Nirmal Raja [Syncfusion]
Replied On February 23, 2011 10:59 PM

Hi Grant,

We are glad to know that the issues has been resolved at your end. Please let me know if you have any concern.

Regards,
Nirmal


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;