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

how to loop through each record

3 Answers 179 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ajmal
Top achievements
Rank 1
ajmal asked on 26 Nov 2010, 12:07 PM
Hello All,

I having a RadGrid and I'm executing below code to get all record in Grid,

GridItem

 

headerItem = grdADInbox.MasterTableView.GetItems(GridItemType.Header)[0];

 


It is giving total rows by, please find attached.

headerItem.OwnerTableView.DataSource

now I need to loop it and read that??

Please help.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Nov 2010, 12:59 PM
Hello Ajmal,

If you want to loop through each record(items) in RadGrid, try the following code snippet.

C#:
foreach (GridDataItem item in RadGrid1.MasterTableView.Items)// loops through each record in grid
     {
 
     }

Thanks,
Princy.
0
ajmal
Top achievements
Rank 1
answered on 26 Nov 2010, 01:10 PM
I want to iterate the item in ItemDataBound method, while the count returen 0 rows.

foreach loop is not working here?
0
Daniel
Telerik team
answered on 26 Nov 2010, 03:42 PM
Hello Ajmal,

It is not possible to iterate the items before they are created. You could use RadGrid_PreRender or Page_PreRender instead.

Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
ajmal
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
ajmal
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or