xiaoming
|
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!
xiaoming
|
|
|
Stan
|
Posted: 07/20/2004, 3:29 AM |
|
Hi
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";
else
document.all["<formName><FileUploadName>"].style.cssText = "";
Stan
|
|
|
xiaoming
|
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
xiaoming
|
|
|
|