G
Guest
I have a web form that I want to fire the Submit web control button when a
user presses the Enter key on the keyboard. I added the following code in my
Page_Load method and it works fine in a web form that contains the Submit web
control button.
Page.RegisterHiddenField("__EVENTTARGET", "btnSubmit");
However, if btnSubmit is in a usercontrol the code above no longer works.
The framework changes the id for the button control to _ctl2_btnSubmit. Does
anyone know how I can work around this problem? I could change the code to:
Page.RegisterHiddenField("__EVENTTARGET", "_ctl2_btnSubmit");
But, if I decide to add another control later I will have to change it again.
Also, this should validate the form since the btnSubmit causevalidation is
set to true.
Please help.
James
user presses the Enter key on the keyboard. I added the following code in my
Page_Load method and it works fine in a web form that contains the Submit web
control button.
Page.RegisterHiddenField("__EVENTTARGET", "btnSubmit");
However, if btnSubmit is in a usercontrol the code above no longer works.
The framework changes the id for the button control to _ctl2_btnSubmit. Does
anyone know how I can work around this problem? I could change the code to:
Page.RegisterHiddenField("__EVENTTARGET", "_ctl2_btnSubmit");
But, if I decide to add another control later I will have to change it again.
Also, this should validate the form since the btnSubmit causevalidation is
set to true.
Please help.
James