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

Accessing template columns with GridDataItem

1 Answer 163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Minh
Top achievements
Rank 1
Minh asked on 19 Sep 2011, 10:20 PM
Hi,

During the OnItemDataBound, I'm using the GridDataItem to retrieve values from the grid. I'm able to do this w/ the regular columns. The instructions for the Template column said:  For template columns you must find the control in the grid cell and extract its value...please provide an example.

the following is the aspx code for the column

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 20 Sep 2011, 06:06 AM
Hello Minh,

You can access the itemtemplate value as follows.
C#:
protected void grid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
 {
     if (e.Item is GridDataItem)
     {   
        string s = ((DataRowView)e.Item.DataItem)["_UnloadTypeName"].ToString();
     }
 }

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