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

Discussion in 'ASP .Net' started by sumit, Nov 7, 2003.

  1. sumit

    sumit Guest

    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

    sumit, Nov 7, 2003
    1. Advertisements

  2. sumit

    Jeff Guest

    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.


    Jeff, Nov 8, 2003
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.