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

[Solved] How to loop the radgrid to get bound data value

2 Answers 268 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jessie
Top achievements
Rank 1
Jessie asked on 30 Jul 2009, 09:11 PM
How to use 

 

foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items)

{


}

to get bound data value.  if I have 2 columns of bound items, one it regular bound item - item1, the other is build in drop down item -item2(NOT template item). I need to get grid cell value in view mode, NOT edit mode.

or there are some other ways to loop the whole grid to get the bound data value?

Thanks,
Jessie

 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 31 Jul 2009, 04:46 AM
Hello Jessie,

You can use UniqueNames of the respective columns to retrieve the cell values in view mode of the grid as shown below:
c#:
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            string strtxt1 = item["BoundColumnUniqueName"].Text; 
            string strtxt2 = item["DropDownColumnUniqueName"].Text; 
        }     
    }     

Thanks
Princy.
0
Jessie
Top achievements
Rank 1
answered on 31 Jul 2009, 02:31 PM
Thanks Princy!
Tags
Grid
Asked by
Jessie
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Jessie
Top achievements
Rank 1
Share this question
or