473,399 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Submit Button event for EnterKey in Asp.Net

Hi All,

I have two textboxes(Emailid,passwd) and a Button Submit in my
Webform.I have set focus to Email textbox by using JavaScript.Now how
to call the Submit button_click event when we hit Enter key from the
Key board?Can any one give me the Code samples for this problem?
Thanx,
Krish.

Mar 18 '06 #1
2 1228
Hi,

with ASP.NET v2.0

You could have

<body onkeypress="if(event.keyCode==13){postForTheButton }" >

<form id="form1" runat="server">
<div>
<asp:TextBox ID="emailid" runat="server" />
<asp:TextBox ID="passwd" TextMode="Password" runat="server" />
<asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" />
<script type="text/javascript" >
function postForTheButton()
{
<%=Page.ClientScript.GetPostBackEventReference(btn Submit,"")%>
}
</script>
</div>
</form>

</body>

If you use v1.0, replace Page.ClientScript.GetPostBackEventReference with
Page.GetPostBackEventReference

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
<co*******@gmail.com> wrote in message
news:11*********************@e56g2000cwe.googlegro ups.com...
Hi All,

I have two textboxes(Emailid,passwd) and a Button Submit in my
Webform.I have set focus to Email textbox by using JavaScript.Now how
to call the Submit button_click event when we hit Enter key from the
Key board?Can any one give me the Code samples for this problem?
Thanx,
Krish.

Mar 18 '06 #2
Hi Teemu Keiski ..

Thanx a lot.... Its workin now....

Mar 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Lloyd Dupont | last post by:
I have a web form with multiple part. I do want the user to click the submit button to post back, so I know which functionality was triggered. unfortunately, when the focus is any text box, if...
5
by: DotNetGruven | last post by:
Hi, I have a web form which has: - Login area with - email textbox - password textbox - <enter> button to log in - search area with - string to search for textbox
1
by: Dave | last post by:
I have a web page with a text box and a query box that submits a query to a database that fills a datagrid. I want the enter key to submit the query - sof far I haven't found a method to it. ...
1
by: Andrea Williams | last post by:
I've created a simple search form and a submit button. On click of the button, I have code-behind that runs and fills a datagrid. However, it the person is focused on one of the other controls...
3
by: Russell | last post by:
I have a web page that i am using an image button as my submit button. The code behind the button works, but when I click enter on the web page, nothing happens. Can anybody tell me how to get my...
1
by: fragmonster | last post by:
Hi, I have a "long time" problem with submit buttons. On my home page, I have 3 .ascx : The first is the login form, the second is the search form and the last is a form which submit some data to...
2
by: Frank | last post by:
Hi! I have a really 'simple' problem. I have an .aspx page with 2 textboxes (login & password) and a Submit button. This works very well, i fill in my login and password and simply press the...
2
by: 23s | last post by:
My site's login page has a form w/ 2 textboxes and a submit button. If I'm in either of those textboxes (i.e., either one of the textboxes has focus), in any given browser, hitting "enter" on my...
5
by: Randall Parker | last post by:
I'm looking at this web page: http://www.allasp.net/enterkey.aspx Where they say: Remember: * <asp:Button> controls render as <input type=submit value=xxx> html elements. *...
1
by: conckrish | last post by:
Hi All, I have two textboxes(Emailid,passwd) and a Button Submit in my Webform.I have set focus to Email textbox by using JavaScript.Now how to call the Submit button_click event when we hit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.