Div in aspnet

  • Thread starter Thread starter wandali
  • Start date Start date
W

wandali

Hello,

I wonder if there is any web forms control or anything else which
allows me to have similar feature as the html tag <div>, in which all
controls within the div will disappear, when I hide it. And more
important is all controls underneath it will shift up...
Thanks in advance.
Wanda
 
Hello,

I wonder if there is any web forms control or anything else which
allows me to have similar feature as the html tag <div>, in which all
controls within the div will disappear, when I hide it. And more
important is all controls underneath it will shift up...
Thanks in advance.
Wanda

Why not use that <div>, with an "id" attribute and a "runat=server" ?
Then you want to set the property "Visible" to "false".

Hans Kesting
 
Hello (e-mail address removed),

Look into the panel control.

<asp:panel></asp:panel>

-john
 
Hi Wanda,

I'm using System.Web.UI.WebControls.Panel for that purpose (it acts as
container for other controls, you can apply css styles to it and you can
make it invisible), but I guess you could also try
System.Web.UI.HtmlControls.HtmlGenericControl ...

Greetings, Ralf
 
Wanda said:
Then what will the exact syntax to setting the div visible = false?

Thanks

if you use <div id="myDiv" runat="server"></div>
then you should have a 'HtmlGenericControl myDiv' in your codebehind
(if not, switch to design-view and back. The value of the "id" attribute
becomes the name of the codebehind-variable)
then you can use 'myDiv.Visible = false'

Hans Kesting
 
Back
Top