How to fire submit button on enter key press on page in asp.net ?


Hi

while working on asp.net project, so many time we will get a requirement to submit data on “Enter Key” press.

We can do this task like this
1.If we have to make “Enter Key” as default save button then we can do like this in .aspx page

<form id="form1" defaultbutton="BtnSubmit" runat="server">

//html code

</form>

2. If we have two or more section of registration form and if the user is on that section and if we have make there “Enter Key” as default save button then we can do like this in panel

<asp:Panel ID="Panel1" DefaultButton="Button1" runat="server">

//html code

</Panel>

Advertisements

2 Responses to “How to fire submit button on enter key press on page in asp.net ?”

  1. aamir Says:

    It’s a really very informative information. It’s very useful and knowledgeable for me. i was stuck while coding this. I will bookmark this page for coding help.

    • Chandra Dev Says:

      Nice to know that you liked this post.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: