RadGrid中的GridTemplateColumn中的FindControl

1 c# telerik radgrid

有没有人知道如何在RadGrid的GridTemplateColumn中FindControl.我可以在EditForm中找到它.但它似乎无法在GridTemplateColumn中找到它.我试图在ItemDataBound事件中执行此操作.if语句永远不会变为真,永远不会进入FindControl.

这就是我想要的:

if (e.Item is GridDataItem)
  {
    GridDataItem item = (GridDataItem)e.Item;
    DropDownList ddlAccountLookup = (DropDownList)item["Account"].FindControl("ddlAccountLookup");
  }
Run Code Online (Sandbox Code Playgroud)

谢谢!

Ica*_*rus 5

Telerik的支持网站显示与您完全相同的方式:

if (e.Item is GridDataItem)  
{  
   GridDataItem item = (GridDataItem)e.Item;  
   Label lbl = (Label)item["IsSportingEvent"].FindControl("LabelSporting");  
}   
Run Code Online (Sandbox Code Playgroud)

我建议你设置一个断点item["Account"]并做一个手表来检查其中包含的控件.