ThanksYou can do this using Javascript.
Thanks,
Sridhar!!
Thanks, How? this text box is in the user control, I know how to use JavaScript to set Focus if the control is a server control but not this one.
You just need to make sure that you use the full client ID of the textbox. You could do this by hard-coding the ID of the user control appended to the ID of the textbox, or you could just get the ClientID of the textbox and pass that to your client script.
Hi Penghao98,
How about usingthis control from Meta builders which will essentially write javascript for you :)
HTH
Thanks, do you think you can give me a little example of it?
Hmm. I am not really for using a third party control, for as simple as this. You should identify your textbox inside the user control (in javascript) and set the focus after the page has loaded.
Lets say your user control id is "uc1"
and id of the textbox inside the "uc1" user control is "txt1"
You should be able to set the focus as
document.getElementById("uc1:txt1").focus();
Remember to place this code after the controls on the form has been loaded. May be after the closing form tag "</form>" in the html
Actually, I believe that would be
document.getElementById("uc1_txt1").focus();
(note the underscore instead of colon)
Yeah Peter is correct it should be
document.getElementById("uc1_txt1").focus();
oops. Sorry for the mistake. It should be underscore. Thanks for correcting me guys
Check out this :view post 821121
regards
0 comments:
Post a Comment