Reputation: 5297
how can declare a variable of type <div>
in asp.net
<div id="b" runat="server"/>
Code
get(b);
private void Get(<div> d)
{
d.Visible=false;
}
i can do this work?How can...
Upvotes: 1
Views: 4821
Reputation: 70012
Use an HtmlGenericControl to declare a div on the server side.
var div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
The answer is still the same, use an HtmlGenericControl.
private void Get(HtmlGenericControl d)
{
d.Visible = false;
}
Upvotes: 4
Reputation: 495
used System.Web.UI.HtmlControls.HtmlGenericControl
Get(b)
private void Get(System.Web.UI.HtmlControls.HtmlGenericControl d) { d.Visiable=false;
}
Upvotes: -2
Reputation: 12561
Within ASP.NET itself, you can just use a <DIV>
no problem. IF you want to access it from the code behind, you can use line like any other contrl
<div id="myDiv" runat="server">
...
</div>
If you're trying to generate one in your code behind, you can use the HtmlGenericControl.
Upvotes: 1