Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Prevent Form Submit on Enter Key Press Using ASP Panel
WhatsApp
Midhun Tp
Aug 05
2016
3.2
k
0
0
<
asp:Panel
ID
=
"panel1"
runat
=
"server"
DefaultButton
=
"Button2"
>
<
asp:TextBox
ID
=
"TextBox1"
runat
=
"server"
>
</
asp:TextBox
>
<
asp:TextBox
ID
=
"TextBox2"
runat
=
"server"
>
</
asp:TextBox
>
<
asp:Button
ID
=
"Button1"
Text
=
"Submit"
runat
=
"server"
/>
<
asp:Button
ID
=
"Button2"
Text
=
"Submit"
runat
=
"server"
Style
=
"display: none;"
OnClientClick
=
"return false"
/>
</
asp:Panel
>
In the above code, enter key click will not result in form submit as the default button of panel is set to "Button2" which is a dummy button with display as none and onclientclick function returning false.
C#
ASP.net
Up Next
Prevent Form Submit on Enter Key Press Using ASP Panel