tags:

views:

614

answers:

3

I have some controls on the page which are Invisible on page load.

But according to user input that many number of controls should get visible. I have done this.

But my page looks little bit dirty because sometimes many controls are invisible. So lot of space is lost.

How can I manage that?

Is there any particular option in Visual Studio 2008 to perform this so that the lost space is adjusted automatically?

+4  A: 

How are you setting the visibility of the controls? There is a difference between visibility setting and display setting.

This link explains it well: Visibility vs Display

If you a specifically talking about ASP.NET controls... Keep in mind that setting Visible="false" for any control causes ASP.NET to not render the control at all, so it's not too useful if you need to toggle the visibility on the client side.

Bryan
There is not property of Visibility="false" it would be Visible="false"
bendewey
Beat me to it! Good job! +1
Cerebrus
heh... Good catch. That's what I get for coding in an auto-completion IDE all these years. :)
Bryan
A: 

Is is possible for you to wrap your Invisible controls in an Panel control or a UserControl. That way you can make your entire Panel Control invisible, hiding the whitespace with it.

bendewey
A: 

How are you toggling the visibility of the controls? If you set the Visibility of a server control to false in Page_Load, it will not render at all and nor will any space it might have taken up. If however, you use Javascript to toggle visibility, make sure to switch the display CSS property of controls, not the visibility property.

The answer also depends on your HTML markup.

Cerebrus