ASP.NET C#
how do i add a title attribute to a panel (div) in the c# code behind file?
ASP.NET C#
how do i add a title attribute to a panel (div) in the c# code behind file?
In your aspx page:
<asp:panel id="MyPanel" runat="server"></asp:panel>
In your codebehind:
protected void Page_Load(object sender, EventArgs e)
{
MyPanel.Attributes.Add("title", "A title for this div");
}
Add a runat="server" attribute to your div, then you can access it like any other ASP.NET control.
markup:
<div id="myDiv" runat="server"></div>
code-behind:
myDiv.Attributes["title"] = "some title";