Javascript with Server Controls queries
-
i have an ASP.net textbox on my form and a dropdownlist too on my form. How can i set the text to "hiii" using JavaScript? IS this correct document.Form1.txtTextBox.value="hiii"; I would also like to set the dropdownlist selected index to 0. How do I do this? As simple as it may sound just bear withe me guys. i really dont know a !@#$ about JavaScript and this is really urgent. I've learnt my lesson though. Tomorrow i'm going to go my self a really good book to teach me this stuff. In the meantime, it'd be great if you could just help me.
-
i have an ASP.net textbox on my form and a dropdownlist too on my form. How can i set the text to "hiii" using JavaScript? IS this correct document.Form1.txtTextBox.value="hiii"; I would also like to set the dropdownlist selected index to 0. How do I do this? As simple as it may sound just bear withe me guys. i really dont know a !@#$ about JavaScript and this is really urgent. I've learnt my lesson though. Tomorrow i'm going to go my self a really good book to teach me this stuff. In the meantime, it'd be great if you could just help me.
You'd need to use
document.getElementById(myControlId).value='some text'
The thing to watch out for though is that the control name you defined will probably be prefixed with _ctl0_ or something similar. You can use the object.ClientId attribute on the server side to find out what it should be."Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox