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

Getting all the GridDataItems

7 Answers 634 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kathy
Top achievements
Rank 1
Kathy asked on 29 Nov 2010, 02:37 AM
I have a RadGrid with paging.  There are 45 pages with 10 items per page.  If I call RadGrid1.Items, I only get the 10 items on the first page.  I want to get all 450 items.  How would I go about doing this?  Thanks.

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Nov 2010, 07:04 AM
Hello Karty,

In order to access all GridDataItems ,disable the paging property. After accessing the data ,set the paging with desired size.Try the following code.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
       RadGrid1.AllowPaging = false;
        foreach (GridDataItem item in RadGrid1.Items)
        {
            //access the item
        }
        RadGrid1.AllowPaging = true;
        RadGrid1.PageSize = 3;
        RadGrid1.Rebind();
}

Thanks,
Princy.
0
Rohan
Top achievements
Rank 1
answered on 22 Nov 2012, 01:51 PM
Hi Princy,

I am facing the same issues , your provided solution not works .. please provide any example .

Thanks.
 
0
Princy
Top achievements
Rank 2
answered on 23 Nov 2012, 06:52 AM
Hi Rohan,

Try the following code snippet to achieve your scenario.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    RadGrid1.AllowPaging = false;
    RadGrid1.Rebind();
    foreach (GridDataItem item in RadGrid1.Items)
    {
        //Your code
    }
    RadGrid1.AllowPaging = true;
    RadGrid1.PageSize = 3;
    RadGrid1.Rebind();
}

Hope this helps.

Regards,
Princy.
0
Rohan
Top achievements
Rank 1
answered on 23 Nov 2012, 08:06 AM
Hi Princy.

Thank you very much for you replay ....
problem still not solved ..

RadGrid1.AllowPaging = false;
    RadGrid1.Rebind();
    foreach (GridDataItem item in RadGrid1.Items)
    {
        //Your code
    }
    RadGrid1.AllowPaging = true;
    RadGrid1.PageSize = 3;
    RadGrid1.Rebind();


after the rebind the function i am not able to get selected row of grid ,  state of GridClientSelectColumn column become false ...
how to get all selected row of radgrid
0
Eyup
Telerik team
answered on 27 Nov 2012, 09:20 AM
Hello Rohan,

You could save the selected items in a collection variable and use it when necessary:
http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-client-sorting-paging-grouping-filtering.html
or
http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-on-sorting.html

I hope this will prove helpful.

All the best,
Eyup
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.
0
Rohan
Top achievements
Rank 1
answered on 27 Nov 2012, 09:28 AM
Hi Eyup,

Thanks for replay ,
I have done all this things to persistence the selected row . My Problem is different , when ever i select the selected row from page 1 to page number such 4 or 5 i can able to access only the last page of radgrid . To access all the page or radgrid i am using this code
RadGrid1.AllowPaging = false;
    RadGrid1.Rebind();
    foreach (GridDataItem item in RadGrid1.Items)
    {
        //Your code
    }
    RadGrid1.AllowPaging = true;
    RadGrid1.PageSize = 3;
    RadGrid1.Rebind();

but after the rebind i am not able to get selected row ...
is there any other  way to get all the row of radgrid please provide any code snap or document ....

Thank you once again for replay...
0
Eyup
Telerik team
answered on 27 Nov 2012, 03:14 PM
Hi Rohan,

I have created a sample RadGrid web site where I implemented preserving and accessing the selected items on filter command. Please check out the attached application and let me know about the result.

Kind regards,
Eyup
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
Kathy
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Rohan
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or