ASP. NET carriage return event instance Parsing

Source: Internet
Author: User

What is the implementation of the button function automatically triggered by ASP. NET carriage return event? What do you need to pay attention? The following is an example of implementing the ASP. NET carriage return event.

Find the implementation on the Internet for comparison:

 
 
  1. <Script language ="Javascript">
  2.  
  3. FunctionDocument. onkeydown ()
  4. {
  5. VarE = event. srcElement;
  6. If(Event. keyCode = 13)
  7. {
  8. Document. getElementById ("Id of the button to be clicked"). Click ();
  9. }
  10. }
  11. </Script>

But this code does not implement what I want. Because there are multiple buttons on my page. The specified button is not able to be stimulated, but it is not what I want. I don't know why?

Being depressed, suddenly the thought of using <asp: Panel> to separate the button came to mind, and the result was successful. Here we will share with you:

 
 
  1. ﹤asp:ImageButton ID="GetBackPwd"   
  2.  
  3. runat="server" SkinID="GetBackPwd"  onlick="getpwd"   /﹥  
  4.  
  5. ﹤asp:Panel ID="panLogin" runat="server"   
  6.  
  7. DefaultButton="Login"﹥  
  8.  
  9. ﹤asp:TextBox ID="txbUserName"   
  10.  
  11. runat="server" ﹥﹤/asp:TextBox﹥  
  12.  
  13. ﹤asp:TextBox ID="txbPwd" runat="server"    
  14.  
  15. TextMode="Password"﹥﹤/asp:TextBox﹥  
  16.  
  17.  
  18. ﹤asp:ImageButton ID="Login" runat="server"   
  19. SkinID="login"  " OnClick="Login_Click" /﹥  
  20.  
  21.  ﹤asp:ImageButton ID="Register" runat="server"   
  22.  SkinID="Register"  onclick="reg"﹥  
  23.  
  24. ﹤/asp:Panel﹥  

In this case, the carriage return will only trigger the Login_Click event because the DefaultButton = "Login"

The basic content of the ASP. NET carriage return event will be introduced here, hoping to help you understand and learn.

  1. In-depth research on Repeater controls: Maximum Flexibility
  2. Getting started with DataList controls
  3. Exploring the operation mechanism of the DataGrid Web Control
  4. Discuss the similarity between ASP. NET data Web controls
  5. Transformation from traditional ASP to ASP. NET: Understanding controls

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.