After Pressing Enter Key should fire the buuton event?

Posted by sarnaiksuraj-12609 under ASP.NET on 12/12/2011 | Points: 10 | Views : 4318 | Status : [Member] | Replies : 3
In my Project there is home page in that home page there is Block Of Login.in that block there is
1)User name
2)password
3)Login Button
Suppose I fill The user Name And Password And The Press Enter Key Should Fire The Login Button Event




Responses

Posted by: Sksamantaray on: 12/12/2011 [Member] Silver | Points: 25

Up
0
Down
set focus on your submit button in Page_Load
this.Button1.Focus();

Thanks,
Sanjay

sarnaiksuraj-12609, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksingh on: 12/12/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

Try below code

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


If u r using panel for or master page then set defaultbutton for corresponing panel.



Regards,
Sunil

sarnaiksuraj-12609, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mittaikariss on: 12/15/2011 [Member] Bronze | Points: 25

Up
0
Down
 private void usertxt_KeyPress(object sender, KeyPressEventArgs e)

{
if (e.KeyChar == (char)Keys.Enter)
{
//call login button action
Login_Click(sender, e);
}
}

http://www.invomtech.com/

....sundarsowmia....

sarnaiksuraj-12609, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response