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

[Solved] Loop Through GridFilteringItem Collection

1 Answer 277 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Troy
Top achievements
Rank 1
Troy asked on 13 Apr 2009, 09:13 PM
(Using Q1 2009)

I have a question that I can't seem to find an answer for --

Currently, if I want to find out the value of a filtered column, say, a TextBox or DatePicker, I am doing something like this:

 

GridFilteringItem item = RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem;

 

 

string Name = (item["Name"].Controls[0] as TextBox).Text;

 

DateTime? FromIHD = (item["Date"].Controls[0] as RadDatePicker).SelectedDate;

But this method requires me to know the "string columnUniqueName" to access the item.

What I would *like* to be able to do is loop through the GridFilteringItems (perhaps by an index?), determine what type of control that column is using (such as a TextBox or RadDatePicker) and get the values of each one.

Maybe I'm just blind, but I didn't see an easy way to do this.

Thanks!

Troy

 

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 15 Apr 2009, 12:08 PM
Hello Troy,

One possible option in this case would be to iterate through the Columns collection of the control.
Then, by accessing each column, you can get its unique name. Thus, you can access the filter item's cell, related to the column.
I hope this suggestion helps.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Troy
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or