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

Filter option with Grid and NULL values

1 Answer 199 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas Weilgaard Yde
Top achievements
Rank 2
Thomas Weilgaard Yde asked on 25 Jan 2012, 03:19 PM
Hi Telerik, 

Question about the Grid and Filter option. 
I have a grid that i bind with a LINQ list that gathers data from a MS SQL server. Now I have a field that can return NULL value (Comment field). When I try to bind a filter option in the Grid to this column I get a NULL Exception. 
The solution I found was to put ISNULL(Comment,'') in my Stored Procedure script. 

But is there another work-around for this NULL data problem with Filter option?

(using the latest build released jan. 5 2012)

Best regards
 - Thomas

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 30 Jan 2012, 03:42 PM
Hello,

One way to resolve this issue is the one that you have found, to modify the data on the MS SQL server.

Another approach is to hook the ItemCommand and check whether the command that fired the event is "Filter". If the CommandName is "Filter" you need to check if the passed value is Null and if it is true you should pass the empty string as a parameter. Otherwise pass the real value.

However, using the ISNULL function is the preferable and the faster way to resolve this issue.

Greetings,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Thomas Weilgaard Yde
Top achievements
Rank 2
Answers by
Andrey
Telerik team
Share this question
or