How to set focus on TextBox web control for the clicked event of ImageButton.

Discussion in 'ASP .Net' started by Gill Smith, May 21, 2004.

  1. Gill Smith

    Gill Smith Guest

    when the page is loaded I am using onload event at the client side and
    setting the focus on the control(TextBox). However when the user clicks on
    Clear ImageButton, I am clearing all the text boxes and the grid(previous
    search result display) in the clicked event of the ImageButton at the server
    side. How to set the focus on the TextBox again when the user clicks on the
    Clear button.
    -Gill
     
    Gill Smith, May 21, 2004
    #1
    1. Advertisements

  2. Gill Smith

    Teemu Keiski Guest

    Hi,

    you could use (generally) Andy Smith's FirstFocus control to set focus to
    the desired TextBox..
    http://www.metabuilders.com/Tools/FirstFocus.aspx

    Certainly you need to know to which TextBox you set the focus on (you can
    store the ID to hidden filed which you read just before clearing the form,
    and then reset the focus after form is cleared)
     
    Teemu Keiski, May 21, 2004
    #2
    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.