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
 
Ad

Advertisements

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
 

Top