I noticed that if I hit enter in the text box instead of clicking on the submit button that the page just refreshes and bttn_click event doesn't occur for the submittal.
After a search I found the following to work:
ClientScript.RegisterHiddenField(string hiddenFieldName, string hiddenFieldInitialValue)
From what I gather this allows the page to have a default button event occur whenever the enter key is pressed in a text box.
My question is how would you go about setting this up for more than one text box and submit button on a page that will do different things other than the default.
I found this:
this.userTxtBx.Attributes.Add("onkeypress", "setEnterKey('userBttn')");
but it does not work in my attempts.
Thanks in advance.After contemplating the problem further, I realize the problem is not so complex.
The simplest solution is html form code defaultbutton=""
Another way is to have a hidden textbox field in your form.
Read this too
http://aspnet.4guysfromrolla.com/articles/060805-1.aspx
Thank you for this.
0 comments:
Post a Comment