Hi,
I have a RadFilter control hooked up to do advanced filtering on a RadGrid. When attempting to apply a filter on a column which contains NULLS in the DB, I get the infamous "Object reference not set to the instance of an object" error. Since I cannot change my database structure, and the Nulls are required, is there anything I can do to allow my RadFilter to filter on these columns?
Best Regards,
Landon
I have a RadFilter control hooked up to do advanced filtering on a RadGrid. When attempting to apply a filter on a column which contains NULLS in the DB, I get the infamous "Object reference not set to the instance of an object" error. Since I cannot change my database structure, and the Nulls are required, is there anything I can do to allow my RadFilter to filter on these columns?
Best Regards,
Landon
6 Answers, 1 is accepted
0
Hello Landon,
I could not reproduce the problem as evidenced by the attached sample. Could you take a look at it and let me know what modification is needed for the issue to be replicated. The column that contains nulls is CategoryID.
Greetings, Tsvetoslav
the Telerik team
I could not reproduce the problem as evidenced by the attached sample. Could you take a look at it and let me know what modification is needed for the issue to be replicated. The column that contains nulls is CategoryID.
Greetings, Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0

Landon
Top achievements
Rank 2
answered on 13 Feb 2012, 05:47 PM
Hi Tsvetoslav,
I appreciate your attempts to replicate the error, but I believe you've forgotten to attach the sample project as I cannot see where to download it.
Thanks,
Landon
I appreciate your attempts to replicate the error, but I believe you've forgotten to attach the sample project as I cannot see where to download it.
Thanks,
Landon
0
Hi Landon,
Sorry for that - here you go, the sample should be attached to this post.
Sorry for that - here you go, the sample should be attached to this post.
Regards,
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0

Landon
Top achievements
Rank 2
answered on 15 Feb 2012, 11:02 PM
Hi Tsvetoslav,
Unfortunately I could not replicate the error within your example, which makes sense because I am doing things a bit differently on my end. In my application, I am using a DBML as my Datasource which is queried by a Linq statement within the "OnNeedDataSource" method on my RadGrid.
Fortunately, I was able to find out exactly what is throwing the "Object reference not set to an instance of an object" error. The error is being bubbled up directly from my DBML's Designer layer ("datasource.designer.cs").
One of the fields that is throwing this error is my "Account" field on my view. When filtering on this field, the error is thrown immediately after the RadFilter loops onto the first record with a NULL as Account. I've shown the Designer code below.
NOTE: I am mainly attempting to use the "contains" expression type, but the "IsNull" expression type seems to work perfectly fine, and finds the NULLS.
I don't believe it's my DBML that is the problem because this View Binds to all of my Grids fine when not being searched (with and without nulls).
I noticed in another thread that one of the Telerik Reps asked "Does your database contain Nulls? Try removing them and then testing" but no one responded. Is there a potential problem with the RadFilter and Nulls in the Database, in some situations?
Unfortunately I could not replicate the error within your example, which makes sense because I am doing things a bit differently on my end. In my application, I am using a DBML as my Datasource which is queried by a Linq statement within the "OnNeedDataSource" method on my RadGrid.
Fortunately, I was able to find out exactly what is throwing the "Object reference not set to an instance of an object" error. The error is being bubbled up directly from my DBML's Designer layer ("datasource.designer.cs").
One of the fields that is throwing this error is my "Account" field on my view. When filtering on this field, the error is thrown immediately after the RadFilter loops onto the first record with a NULL as Account. I've shown the Designer code below.
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage=
"_Account"
, DbType=
"VarChar(200)"
)]
public
string
Account
{
get
{
return
this
._Account; //THROWING ERROR WHEN THIS FIELD IS FOUND TO BE NULL
}
set
{
if
((
this
._Account != value))
{
this
._Account = value;
}
}
}
NOTE: I am mainly attempting to use the "contains" expression type, but the "IsNull" expression type seems to work perfectly fine, and finds the NULLS.
I don't believe it's my DBML that is the problem because this View Binds to all of my Grids fine when not being searched (with and without nulls).
I noticed in another thread that one of the Telerik Reps asked "Does your database contain Nulls? Try removing them and then testing" but no one responded. Is there a potential problem with the RadFilter and Nulls in the Database, in some situations?
0
Hello Landon,
Could not replicate the issue even with a dbml data context. Attached is the new sample.
All the best,
Tsvetoslav
the Telerik team
Could not replicate the issue even with a dbml data context. Attached is the new sample.
All the best,
Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Hello Landon,
Just an extra note: please, remove the DataSourceID property of the RadGrid and MasterTableView tags in the mark-up. The column that contains nulls and which you can apply a Contains filter operator on, is the Quantity per Unit one.
All the best,
Tsvetoslav
the Telerik team
Just an extra note: please, remove the DataSourceID property of the RadGrid and MasterTableView tags in the mark-up. The column that contains nulls and which you can apply a Contains filter operator on, is the Quantity per Unit one.
All the best,
Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>