简体   繁体   中英

Fires logout button when I press enter key on IE

I have asp.net master page with a logout button. Also I have 20 web Form use this master page.

My issues is when I press enter key on the page even if the logout button in not focused, the logout button gets fired. This issues is happening only in IE browser.

I want to prevent the firing logout button if the logout button is not focused

 <body> <form id="form1" runat="server" > <asp:ImageButton ID="imgbtnLogout" runat="server" useSubmitBehavior="false" ImageUrl="~/Images/logout_img.jpg" Width="33px" Height="35px" onclick="imgbtnLogout_Click" /> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </form> </body>

Can any one help me to fix this issue

I have faced same issue, which is resolved by implementing below code.

step1: add button control in your master page.

step 2: set default button in form tag in your master page.

Step 3: Run your application and check your issue now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM