aspx script, UserName Password KeyDownHandler:
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
TextBox userNameControl = FindControl("UserName") as TextBox;
TextBox passwordControl = FindControl("Password") as TextBox;
if (userNameControl != null)
userNameControl.Attributes.Add("onKeyDown", "KeyDownHandler(this)");
if (passwordControl != null)
passwordControl.Attributes.Add("onKeyDown", "KeyDownHandler(this)");
}
</script>
script:
<script type="text/javascript">
function KeyDownHandler(domButton)
{
if (event.keyCode == 13)
{
event.returnValue=false;
event.cancel = true;
domButton.click();
}
}
</script>