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.
Syncfusion Feedback

Problem with sorting in GridControl

Thread ID:

Created:

Updated:

Platform:

Replies:

78062 Nov 26,2008 01:44 PM UTC Nov 27,2008 12:20 PM UTC Windows Forms 4
loading
Tags: GridControl
Markus Persson
Asked On November 26, 2008 01:44 PM UTC

I don't know if this is a problem within Syncfusion or .NET, but I have a GridControl with a column of numbers. In the GridControl Designer so have I set this column to have CellValueType "System.Decimal".

I have a DataView that I use to fill my GridControl with, and use its Sort property to sort the GridControl. However, when I sort I end up with results like: 1, 10, 100, 11, 2, 3 when I want: 1, 2, 3, 10, 11, 100.
I have tried set the column in the DataSet as Decimal as well and then the sort works nice but I can't type in an empty value since I then get an error saying that it's not a valid value for Decimal.

So, I want to be able to sort like 1, 2, 3, 10, 11, 100 and also be able to type in empty values in my cell on the grid.

I'm using Syncfusion 6.4.0.15 and VS 2005.


Nisha Arockiya A [Syncfusion]
Replied On November 27, 2008 09:27 AM UTC

Hi Markus,

Thanks for your interest in Syncfusion Products.

This exceptions is being thrown when trying to parse as a double a value of DBNull into a empty row.

You can add an extra condition to your parse code inorder to handle the DBNull problem.

if(o == DBNull.Value)
{
//do your code for empty values
}


Please let me know if this serve your needs.

Regards,
Nisha


Markus Persson
Replied On November 27, 2008 10:40 AM UTC

Thank you Nisha. This line did the trick for me in my SaveCellFormattedText event.


Me.DataView1(row - 1)(col) = DBNull.Value


If anyone is interested in the whole sub:


Dim col As Integer = CType(sender, GridModel).CurrentCellInfo.ColIndex
Dim row As Integer = CType(sender, GridModel).CurrentCellInfo.RowIndex

If row > 0 And col > 0 Then
If e.Text = "" Then
Me.DataView1(row - 1)(col) = DBNull.Value
Else
Me.DataView1(row - 1)(col) = e.Text
End If
End If



Markus Persson
Replied On November 27, 2008 10:43 AM UTC

Or even shorter...


If row > 0 And col > 0 Then
Me.DataView1(row - 1)(col) = IIf(e.Text = "", DBNull.Value, e.Text)
End If



Nisha Arockiya A [Syncfusion]
Replied On November 27, 2008 12:20 PM UTC


Hi Markus,

Thanks for all the Updates.Please let us know any other concerns.

Regards,
Nisha


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.

Warning Icon 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.Close Icon

;