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

access the values of autogenerated radgrid

1 Answer 8 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dawson
Top achievements
Rank 1
Dawson asked on 26 Nov 2013, 01:41 PM
Hi.
I have an autogenerated radgrid i want to access the values in it from code behind. How to access it when i dont know its uniquename.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Nov 2013, 01:50 PM
Hi Dawson,

Please try the following code snippet.

C#:
protected void RadGrid1_ItemDataBound1(object sender, GridItemEventArgs e)
 {
   if (e.Item is GridDataItem)
   {
       GridDataItem item = (GridDataItem)e.Item;
       foreach (GridColumn col in RadGrid1.MasterTableView.AutoGeneratedColumns)
       {
           if (col is GridBoundColumn)
           {
           string value = item[col.UniqueName].Text;
           }        
       }
   }
 }

Thanks,
Shinu
Tags
Grid
Asked by
Dawson
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or