Home » Category » Web Forms

Web Forms: HtmlInputFile Style Question

102| Sat, 05 Jan 2008 23:22:00 GMT| cspace| Comments (3)

Hi All,

Using VB.NET, ASP.NET in framework 1.1 on a webform, I have a Button (system.web.ui.webcontrols.button) that when clicked enables and makes visible an HtmlInputFile control called AdFN. Initially, I have the disabled property set to TRUE and it's visibility setting set to Hidden in it's style property. In the HTML of the aspx file, I have this code:

<INPUT id="AdFN" style='VISIBILITY: hidden; WIDTH: 304px; HEIGHT: 22px' disabled type='file' size='31' name='AdFN' RunAt='Server'>

In the onClick handler of the Button in the code behind page, I use:
AdFN.Disabled = False
AdFN.Style.Item("Visibility") = Visible

The AdFN becomes enabled and visible. This works fine.

My question is how to make it Hidden again in a cleanup routine I have in another webcontrol button called Cancel.

I've tried:
AdFN.Style.Item("Visibility") = Hidden
AdFN.Style.Item("Hidden") = True

Neithor throws an exception. However, neithor makes the control hidden.

Can someone tell me the magic statement to use in my onClick handler of the Cancel button to make it hidden again?

I know about the tricks of masking or covering it with an object but it seems that if I can make it visible using AdFN.Style.Item I should also be able to make it hidden in a similar fashion.

Thanks in advance.

Stewart

Keywords & Tags: htmlinputfile, style, web, forms

URL: http://dotnet.itags.org/web-forms/134948/
 
«« Prev - Next »» 3 helpful answers below.

You will need to set the other style attributes in code also. display:[inline | block} etc.

Me.AdFN.Style.Item("display") ="none"

Regards,

Martin.

mokeefe | Sat, 05 Jan 2008 23:23:00 GMT |

Hi Martin,

Thanks a bunch!

Stew Wink

cspace | Sat, 05 Jan 2008 23:24:00 GMT |

Glad to be of help. you could close this or flag as appropriate.

Thanks,

Martin

mokeefe | Sat, 05 Jan 2008 23:25:00 GMT |

Web Forms Hot Answers

Web Forms New questions

Web Forms Related Categories