【问题标题】:Find html control in gridview rowdatabound event in asp.net?在asp.net的gridview rowdatabound事件中查找html控件?
【发布时间】:2017-01-05 07:09:53
【问题描述】:

在asp.net中我们可以找到HTML标准控件

(HtmlInputControlName)e.Item.FindControl("control_id");

我的问题是我可以找到段落 HTML 标记

<p id="p_id" runat="server">

如果是,那么控件名称是什么

【问题讨论】:

    标签: asp.net gridview rowdatabound


    【解决方案1】:

    你使用HtmlGenericControl

    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        HtmlGenericControl p = e.Row.FindControl("p_id") as HtmlGenericControl;
        p.InnerText = "It works!";
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-30
      • 2011-05-24
      • 2011-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多