By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,570 Members | 999 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,570 IT Pros & Developers. It's quick & easy.

Is there a way to make an ASP.Net control invisible other than the "visible" property?

P: n/a
I have some controls that I want to be invisible, but if the user does
something, they will become visible using javascript. So I can't set
its "visible" property to false, because then they won't even be
rendered in the page at all. I can set them to invisible using
javascript, but I don't want to do that because then their visibility
isn't saved in the viewstate. Is there any way to make them invisible
from the code-behind file in a way that will be saved in the viewstate
and so that the controls can be accessed through client-side script?

thanks in advance
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can attach the style attribute and set it to invisible. That way, it is rendered on the client and you can change the property to visible in javascript

Tu-Thac
www.ongtech.co

----- john wrote: ----

I have some controls that I want to be invisible, but if the user doe
something, they will become visible using javascript. So I can't se
its "visible" property to false, because then they won't even b
rendered in the page at all. I can set them to invisible usin
javascript, but I don't want to do that because then their visibilit
isn't saved in the viewstate. Is there any way to make them invisibl
from the code-behind file in a way that will be saved in the viewstat
and so that the controls can be accessed through client-side script

thanks in advanc

Nov 18 '05 #2

P: n/a
If your control is named myControl

myControl.Style.Add("visibility","hidden");
-- or --
myControl.Style.Add("display", "none");

depending on whether you want the control to hold it's space. (display none
does not hold space in the page, where as setting the visibility will).

Matt
http://www.3internet.co.uk
"john" <jo********@yahoo.com> wrote in message
news:29**************************@posting.google.c om...
I have some controls that I want to be invisible, but if the user does
something, they will become visible using javascript. So I can't set
its "visible" property to false, because then they won't even be
rendered in the page at all. I can set them to invisible using
javascript, but I don't want to do that because then their visibility
isn't saved in the viewstate. Is there any way to make them invisible
from the code-behind file in a way that will be saved in the viewstate
and so that the controls can be accessed through client-side script?

thanks in advance

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.