change Visibility of a control in ASP.NET code behind (c#)
Posted
by Axel Grude
on Stack Overflow
See other posts from Stack Overflow
or by Axel Grude
Published on 2010-06-03T11:48:53Z
Indexed on
2010/06/03
12:14 UTC
Read the original article
Hit count: 437
How do you set the visibility of a (fileupload) control from ASP.net code (I need to hide a fileupload control in a webuser control from server site, otherwise hasFIle is always false). Also setting the "Visible" property to false does not work (as is confuses the AJAX panel so the fileupload forgets that it has a file).
theFileUpload.Visible = false => does not work so I want to try to set the CSS style visibility to hidden or display to none.
The main problem is I want to do it from the server side (I know how I could do it on client).
Is there a safe way to overwrite
theFileUpload.Attributes["styles"]
in case I modify other CSS styles in there, also throwing a whole CSS class at it (by moidifying the CSSClass property) seems like overkill.
thanks in advance Axel
© Stack Overflow or respective owner