Reputation: 331
Is there any way to prevent a ASP.Net Panel from rendering a DIV?
Upvotes: 1
Views: 1125
Reputation: 11
as reflector says:
public Panel() : base(HtmlTextWriterTag.Div)
{
}
inherit Panel in your class and make constructor with tag you need.
Upvotes: 1
Reputation: 245479
You can set the div to be a server-side control and then access it through the code-behind:
<div id="myDiv" runat="server">Some Content</div>
And then wherever you want to set the visibility:
var control = Page.FindControl("myDiv") as HtmlGenericControl;
control.Visible = false;
Upvotes: 2