Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6033395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:28:37+00:00 2026-05-23T05:28:37+00:00

net web page I have textBox and button. I added onClick for button. Problem

  • 0

net web page I have textBox and button.

I added onClick for button.

Problem is that if I click enter in textBox it also call onClick event for button. I understand why.

My code is here:

TextBox is in view:

                      <asp:View ID="BlView" runat="server">
                           <p class="tabHead"> BLACK LIGHT LABEL DATA </p>
                            <table class="tab">
                                <tr>
                                    <td>
                                        <asp:Label ID="Label1" runat="server" class="label" Text="BARCODE" />
                                    </td>
                                    <td>
                                        <asp:TextBox ID="bl_tb_barcode" runat="server" BorderWidth="1px" 
                                            class="textBox"  Width="700"/>
                                    </td>
                                </tr>
                            </table>
                     </asp:View> 

Button code is here:

       <div class="divPrinter">
        <asp:DropDownList runat="server" class="dropDownList" Width="250" Height="35" 
            ID="cbPrinters" style="margin-top:80px"/>
        <asp:Button ID="btnPrint" runat="server" class="btnPrint" style="margin-top:80px"
            Width="120" Height="35"  Text="Print" onclick="BtnPrintClick"  />
        </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:28:38+00:00Added an answer on May 23, 2026 at 5:28 am

    I take it you don’t want the Enter key to have any effect? If so, add this tag to your textboxes:

    onKeyDown = "return (event.keyCode != 13)"
    

    so it would be like this:

    <asp:TextBox ID="bl_tb_barcode" runat="server" BorderWidth="1px" 
         class="textBox"  Width="700" onKeyDown="return (event.keyCode != 13)"/>
    

    As a side note, onKeyDown is a Javascript event, so it won’t execute on the server. The code will return false so a postback will not occur.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ASP.NET web page that contains many textboxes. Each textbox has a
I have a dynamically created TextBox in a C#/ASP.NET web page that I want
I have an ASP.NET web page that displays a variety of fields that need
I have an asp.net web page with a ton of code that is handled
I have an asp.net web page (C# 2008) where the user would enter an
I have an asp.net webpage that only contains a textbox and a button. The
I have to filter user input to on my web ASP.NET page: <asp:TextBox runat=server
Here's the scenario: I have a textbox and a button on a web page.
Using ASP.Net, VB.Net In my web page, i have the textbox values when i
I have an asp.net web application, in that I want to add a page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.