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

[Solved] How to get all item values from RadGrid DataKeyName when implementing paging

4 Answers 1336 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ads
Top achievements
Rank 1
Ads asked on 12 Aug 2011, 05:41 AM
I have a radgrid bound to a datasource. I would like to return all values from a single column (my DataKeyName) column.

I have the AllowPaging property set to true and when my RadGrid loads it loads the first 10 rows and I'm able to page through to the remainder of the data.

My function below works but only returns DataKeyName values for the first 10 rows. If I change the Page Size drop down of the RadGrid to 50 then the function returns 50 values etc

List<string> Emails = new List<string>();
 
            foreach (GridDataItem item in RadGrid.MasterTableView.Items)
            {
                Emails.Add(item.GetDataKeyValue("Email").ToString());
            }

Is there something I can do to get this function to return ALL DataKeyName values and still implement paging?

4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 12 Aug 2011, 07:59 AM
Hello,

List<string> Emails = new List<string>();
RadGrid1.AllowPagging = false;
RadGrid1.Rebind();
  
            foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
            {
                Emails.Add(item.GetDataKeyValue("Email").ToString());
            }
 
RadGrid1.AllowPagging = true;
RadGrid1.Rebind();

Let me know if any concern.
Thanks,
Jayesh Goyani
0
Joel R
Top achievements
Rank 1
answered on 01 Dec 2012, 12:38 AM
works like a champ.... Thanks
0
Mohammad
Top achievements
Rank 1
answered on 31 Jul 2013, 12:04 PM
Hii  Jayesh Goyani


Is this the only way ?.

Can I do it without rebinding the grid ?

Thanks,

Mohammad Jouhari. 
0
Jayesh Goyani
Top achievements
Rank 2
answered on 31 Jul 2013, 12:10 PM
Hello,

There is not any other way to get this.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Ads
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Joel R
Top achievements
Rank 1
Mohammad
Top achievements
Rank 1
Share this question
or