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

How to get Grid data on code behind on paging

3 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ignacio Ortuzar
Top achievements
Rank 1
Ignacio Ortuzar asked on 22 Apr 2010, 07:05 PM
Hi,

I need to get a grid data when paging...actually I have this code and it works good, but may be exist a better way to do this.


            string ids = ""
            this.rg_lead.AllowPaging = false
            this.rg_lead.DataBind(); 
 
            foreach (GridDataItem item in this.rg_lead.Items) 
            { 
                if (!ids.Contains("," + item["id"].Text + ",") && ids.Split(',')[0] != item["id"].Text) 
                { 
                    ids += item["id"].Text + ","
                } 
            } 
 
            this.rg_lead.AllowPaging = true
            this.rg_lead.DataBind(); 

Thanks

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Apr 2010, 06:25 AM
Hi,

When paging is enabled in the grid, only the items for the current page are retrieved. If you want to operate with all records from the source when the grid paging is enabled, reference directly the data from the underlying data source to process further operations over it.

Checkout the forum link which discussed on similar scenario.
Get all rows

Regards,
Princy.
0
Ignacio Ortuzar
Top achievements
Rank 1
answered on 23 Apr 2010, 01:39 PM
Thanks for the reply Princy.

Unfortunately I can't retrieve the data directly from database because I'm using some filters, so if I get the data from database I'll be ignoring the filters.

So the solution I'm using it's OK.

Now I've another question, what is the difference between DataBind and Rebind?

Regards
0
Radoslav
Telerik team
answered on 23 Apr 2010, 03:35 PM
Hello Ignacio,

Please check out the following online documentation articles:
http://www.telerik.com/help/aspnet-ajax/telerik.web.ui-telerik.web.ui.gridtableview-rebind.html
http://www.telerik.com/help/aspnet-ajax/telerik.web.ui-telerik.web.ui.gridtableview-databind%28%29.html

I hope this helps.

Regards,
Radoslav
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
Ignacio Ortuzar
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ignacio Ortuzar
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or