OnKeyPress = "reload page"

Discussion in 'ASP .Net' started by Guest, Aug 24, 2005.

  1. Guest

    Guest Guest


    I've got the following in my aspx

    <asp:textbox id="findwhat" OnKeyPress="javascript:suggest()"></asp:textbox>

    and the suggest function

    function suggest()

    btnfind is an asp:imagebutton control, with a handler in the codebehind. So
    in theory, typing in the box performs whatever action pressing that button
    does. Except it doesnt. It reloads the page, completely.

    Any idea whats going on!?


    Guest, Aug 24, 2005
    1. Advertisements

  2. Guest

    Guest Guest

    Tried 3 different implementations of AJAX and none of them work for me!
    Anyway, fixed it now cheers.

    Problem now is how to put the cursor back into the textbox after refresh -
    without selecting the text. Any thoughts?

    Guest, Aug 24, 2005
    1. Advertisements

  3. Dan,

    btnfind is a server button and as such it causes a postback. Consider using


    Eliyahu Goldin, Aug 24, 2005
  4. <body onload='findwhat.focus()'>


    Eliyahu Goldin, Aug 24, 2005
    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.