TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Prevent Form Submit on Enter Key Press Using ASP Panel
Midhun Tp
Aug 05
2016
Code
3
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
<
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