【问题标题】:FindControl in GridTemplateColumn in RadGridRadGrid 中 GridTemplateColumn 中的 FindControl
【发布时间】:2011-10-29 02:10:55
【问题描述】:

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

这就是我正在尝试的:

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

谢谢!

【问题讨论】:

    标签: c# telerik radgrid


    【解决方案1】:

    Telerik's support website 显示的方式与您的操作方式完全相同:

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

    我建议你在item["Account"] 上设置一个断点,然后观察一下其中包含哪些控件。

    【讨论】:

      【解决方案2】:

      如果您的 UniqueName 不是“帐户”,则代码无法找到“帐户”中的控件

      【讨论】:

        猜你喜欢
        • 2011-12-20
        • 1970-01-01
        • 1970-01-01
        • 2014-09-10
        • 1970-01-01
        • 1970-01-01
        • 2011-12-05
        • 2012-09-23
        • 1970-01-01
        相关资源
        最近更新 更多