GridBoundColumn finding the control

I have a Telerik Grid with the column below. I want to find a control and tried the code below and get this error:

Cannot convert type 'System.Web.UI.Control' to 'Telerik.Web.UI.GridBoundColumn'      

Not sure what I'm doing wrong:
//in grid
 <telerik:GridBoundColumn DataField="Id" Visible="false" HeaderText="Id" 
                    UniqueName="Id"  ConvertEmptyStringToNull="False">
                </telerik:GridBoundColumn>

//in code


 int rowId = Convert.ToInt16(e.CommandArgument);
               GridDataItem item = rgApplicants.Items[rowId];
               GridBoundColumn test = (GridBoundColumn)item.FindControl("Id"); //error here

Open in new window

LVL 8
CamilliaAsked:
Who is Participating?
 
ddayx10Connect With a Mentor Commented:
OOPS:
NEW:
Telerik.Web.UI.GridBoundColumn test = (Telerik.Web.UI.GridBoundColumn)item.FindControl("Id");
0
 
ddayx10Commented:
Should be able to do this I would imagine:

OLD:
GridBoundColumn test = (GridBoundColumn)item.FindControl("Id");

NEW:
GridBoundColumn test = (Telerik.Web.UI.GridBoundColumn)item.FindControl("Id");
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.