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:
- <Script language ="Javascript">
-
- FunctionDocument. onkeydown ()
- {
- VarE = event. srcElement;
- If(Event. keyCode = 13)
- {
- Document. getElementById ("Id of the button to be clicked"). Click ();
- }
- }
- </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:
- ﹤asp:ImageButton ID="GetBackPwd"
-
- runat="server" SkinID="GetBackPwd" onlick="getpwd" /﹥
-
- ﹤asp:Panel ID="panLogin" runat="server"
-
- DefaultButton="Login"﹥
-
- ﹤asp:TextBox ID="txbUserName"
-
- runat="server" ﹥﹤/asp:TextBox﹥
-
- ﹤asp:TextBox ID="txbPwd" runat="server"
-
- TextMode="Password"﹥﹤/asp:TextBox﹥
-
-
- ﹤asp:ImageButton ID="Login" runat="server"
- SkinID="login" " OnClick="Login_Click" /﹥
-
- ﹤asp:ImageButton ID="Register" runat="server"
- SkinID="Register" onclick="reg"﹥
-
- ﹤/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.
- In-depth research on Repeater controls: Maximum Flexibility
- Getting started with DataList controls
- Exploring the operation mechanism of the DataGrid Web Control
- Discuss the similarity between ASP. NET data Web controls
- Transformation from traditional ASP to ASP. NET: Understanding controls