Find html control in gridview rowdatabound event in asp.net?

3.4k views Asked by At

In asp.net we can find HTML standard control using

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

My question is that can I find paragraph HTML tag

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

If yes, than what will be control name

1

There are 1 answers

0
VDWWD On BEST ANSWER

You use HtmlGenericControl

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