how to set focus on a textbox after onclick of a button

S

sumit

Hi,
I want to set focus on a textbox after i click on a button
on .aspx page.
I have written it in java script but it sets before
page_load event occurs and after event of buttonclick it
goes off!!

can anyone suggest how to set it!1

thanks
sumit
 
J

Jeff

Instead of using a ServerControl for the button, use a HTML control. Then,
in your code-behind, add code
btnAddAttach.Attributes.Add("onclick", "javascript:doSomething");

to get the button to respond to the onclick event. Just make sure the
<INPUT tag has the runat="server" attribute so that you can update the
button via code.

HTH

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top