CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> CodeCharge Studio -> .NET

 show/hide file upload control

Print topic Send  topic

Author Message
Posted: 07/19/2004, 9:02 AM

I have a listbox and a file upload component. I want the file upload component to be visible/invisible depending on the value selected in the listbox. How can I do it? which is the best way, using JavaScript or a server-side script?

thanks in advance!

Posted: 07/20/2004, 3:29 AM


You can try the following solution

1. Add Client Custom Code to the OnChange event of your Listbox
2. Write following code in it

if(document.forms["_ctl0"].<formName><ListBoxName>.value != "2")
document.all["<formName><FileUploadName>"].style.cssText = "display:none";
document.all["<formName><FileUploadName>"].style.cssText = "";

Posted: 07/20/2004, 11:04 AM

this does the trick. thanks, Stan!

Now I have another question: when the file upload shows up and user select a file, then the user changes his mind and select anothe item from the list box, the file upload will hide but the file is still in the text box and will upload to the server. How to set the text in the file upload contro to NULL?

Many thanks


Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

Web Database

Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.