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

[Solved] Filtering MasterTableView When RADGrid is binded to List Object

2 Answers 210 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yuvika
Top achievements
Rank 1
Yuvika asked on 10 Nov 2009, 11:05 AM
Hi,

Binding RADGrid to list object in general case scenario works good. But I have a situation where I am using the RADGrid for showing hierachical data and I am using self referencing telerik RADgrid grid. For the first level my parentFileID property has null value. so I want to filter my records for masterTableView with FileParentId.

The below code gives error when I bind the grid to a list object.

if

(Assembly.GetAssembly(typeof(ScriptManager)).FullName.IndexOf("3.5") != -1)

 

{

grdsearchresult.MasterTableView.FilterExpression =

@"it[""FileParentID""] = Convert.DBNull";

 

}

 

else

 

 

 

 

{

grdsearchresult.MasterTableView.FilterExpression =

"FileParentID IS NULL";

 

}

For Eg:

 

 

List

<SearchResult>  listSearchResults=new List<SearchResult>();

grdsearchresult.DataSource = listSearchResults;

 

grdsearchresult.DataBind();
Here my datasource is List Type Object.The grid shows all records if I dont filter it.
So While binding the master records I get error index is not defined.?
Can't I bind the RADGrid with list object and provide filter to it.

Please reply.
Thanks,
Yuvika

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 13 Nov 2009, 08:29 AM
Hi Yuvika,

Can you try:

grdsearchresult.MasterTableView.FilterExpression = "FileParentID == null";

to see what will be the result?

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Yuvika
Top achievements
Rank 1
answered on 13 Nov 2009, 12:56 PM
Hi,

Thanks. It worked.

Thanks and Regards,
Yuvika
Tags
Grid
Asked by
Yuvika
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Yuvika
Top achievements
Rank 1
Share this question
or