using asp:textbox as search box, handling enter in textbox

Discussion in 'ASP .Net' started by Imran Aziz, Sep 3, 2005.

  1. Imran Aziz

    Imran Aziz Guest

    Hello All,
    I have an option of search on my web page coded as under

    <p>Search Bookmarks: <asp:TextBox ID="txtSearch" runat="server"
    class="texta" ></asp:TextBox><asp:Button ID="btnSearch" runat="server"
    class="button" Text="go" OnClick="btnSearch_Click" UseSubmitBehavior="true"
    /></p>



    Now the issue is that although it works fine when the button is pressed, but
    when someone enters text in the textbox and presses enter it does not do
    anything, because the buttons OnClick event is not fired. How can I
    associate the textbox with the button control, so that when someone does an
    enter in the textbox then the buttons OnClick handler is called?



    Imran.
    Imran Aziz, Sep 3, 2005
    #1
    1. Advertising

  2. Imran Aziz

    Siva M Guest

    Hi,

    Check this one: http://aspnet.4guysfromrolla.com/articles/060805-1.aspx

    "Imran Aziz" <> wrote in message
    news:u$...
    Hello All,
    I have an option of search on my web page coded as under

    <p>Search Bookmarks: <asp:TextBox ID="txtSearch" runat="server"
    class="texta" ></asp:TextBox><asp:Button ID="btnSearch" runat="server"
    class="button" Text="go" OnClick="btnSearch_Click" UseSubmitBehavior="true"
    /></p>



    Now the issue is that although it works fine when the button is pressed, but
    when someone enters text in the textbox and presses enter it does not do
    anything, because the buttons OnClick event is not fired. How can I
    associate the textbox with the button control, so that when someone does an
    enter in the textbox then the buttons OnClick handler is called?



    Imran.
    Siva M, Sep 3, 2005
    #2
    1. Advertising

  3. Imran Aziz

    Imran Aziz Guest

    Thanks a lot for the useful link.
    Imran.

    "Siva M" <> wrote in message
    news:...
    > Hi,
    >
    > Check this one: http://aspnet.4guysfromrolla.com/articles/060805-1.aspx
    >
    > "Imran Aziz" <> wrote in message
    > news:u$...
    > Hello All,
    > I have an option of search on my web page coded as under
    >
    > <p>Search Bookmarks: <asp:TextBox ID="txtSearch" runat="server"
    > class="texta" ></asp:TextBox><asp:Button ID="btnSearch" runat="server"
    > class="button" Text="go" OnClick="btnSearch_Click"
    > UseSubmitBehavior="true"
    > /></p>
    >
    >
    >
    > Now the issue is that although it works fine when the button is pressed,
    > but
    > when someone enters text in the textbox and presses enter it does not do
    > anything, because the buttons OnClick event is not fired. How can I
    > associate the textbox with the button control, so that when someone does
    > an
    > enter in the textbox then the buttons OnClick handler is called?
    >
    >
    >
    > Imran.
    >
    >
    >
    Imran Aziz, Sep 5, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?am9l?=
    Replies:
    0
    Views:
    722
    =?Utf-8?B?am9l?=
    Sep 28, 2006
  2. Sunfire
    Replies:
    2
    Views:
    1,046
    Sunfire
    Nov 6, 2007
  3. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    369
    Anders Matthiessen
    Jan 12, 2005
  4. jhoff

    Return / Enter handling on Textbox

    jhoff, Aug 14, 2006, in forum: Javascript
    Replies:
    1
    Views:
    115
    Lasse Reichstein Nielsen
    Aug 14, 2006
  5. HopfZ
    Replies:
    0
    Views:
    537
    HopfZ
    Aug 28, 2006
Loading...

Share This Page