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

I

Imran Aziz

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.
 
S

Siva M

Hi,

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

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.
 

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top