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

Access the filtered items on a RadGrid

3 Answers 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
john
Top achievements
Rank 1
john asked on 26 Oct 2010, 03:06 PM
Hello,

I'm hoping there's an elegant way to access just the filtered items on a RadGrid.  For example, a user sets a filter on a column in the grid, and the results change from 1,000 records to, say, 500 records - I'd like to access just these 500 records.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Oct 2010, 08:49 AM
Hi John,


You can iterate through the filtered items using the following code.

C#:
protected void Button1_Click(object sender, EventArgs e)
    {
        // Access the items shown in grid
        foreach( GridDataItem item in RadGrid1.MasterTableView.Items)
        {
            // Response.Write(item["ColumnUniqueNameHere"].Text);
        }
    }



-Shinu.
0
john
Top achievements
Rank 1
answered on 27 Oct 2010, 01:44 PM
First, thanks for the reply.

Second, I should have been more specific.  I'm using pagination with this grid, so the Items collection on the MasterTableView only contains the first page of results (10, in this case.)  Is the Items collection a magic Telerik collection that will lazy-load the rest of the objects if I iterate it?  Or will I need to use a different method?

Thanks.
0
Iana Tsolova
Telerik team
answered on 29 Oct 2010, 03:28 PM
Hello john,

When you have paging for the grid all the items RadGrid has are the items on the current page. So you cannot access the items that are not present through the displayed ones.

Sincerely yours,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
john
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
john
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or