Re: Wrong Form Submit

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Kevin Spencer (kspencer_at_takempis.com)
Date: 12/13/04


Date: Mon, 13 Dec 2004 11:10:19 -0500

You'll probably want to capture the ENTER key to prevent this. Itg isn't a
matter of clicking a button when ENTER is pressed. ENTER submits the form in
most browsers. You can use JavaScript to capture the ENTER key.

-- 
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"P1ayboy" <P1ayboy@discussions.microsoft.com> wrote in message
news:D6140CB8-C768-4381-9296-B713D5A953E4@microsoft.com...
> I have two forms on a page, one for logging in a user and a second one to
> search thesite. The problem is, when i enter data into the search and hit
> enter, it activates the login button. I need to know how to associate a
> textbox with a particular button.
>
>
> <asp:TextBox ID="keyword" Runat=server ></asp:TextBox>
> <asp:imagebutton OnCommand="runSearch" id="runbutton" Runat=server />
>
> so when the focus is on keyword and I hit enter, it will run "runSearch"
and
> not other command on other buttons.
>
> Cheers
>
> Rob

Quantcast