Dec 21, 2006 - 12:54 AM
I mean I want to "simulate" a button click and there might be several buttons on the page doing different stuff.
Dec 21, 2006 - 06:27 AM
Sometimes, this is the default behavior when the enter key is pressed...it depends on whether or not you a single "submit" button on a page (this includes usercontrols, third party controls, etc.).
I think there are a couple of ways you could go about simulating this behavior - both of them being client-side, however.
Dec 27, 2006 - 09:54 PM
This will set btnSubmit as default button of the form
Dec 28, 2006 - 03:29 AM
I ended up doing it this way serverside (ASP.NET 2 / C#):
string loginFocusScript = "!";
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "loginFocus", loginFocusScript);
Not too happy with it, but it works.