can you put a small demo page tha reproduces this problem?
Well, I figured what was causing the problem, but not the problem itself.
If I remove this line from my Page Load it works fine:
ClientScript.RegisterHiddenField("__EVENTTARGET", "btnSubmit")
Any ideas? Does ajax consider "_" to be an invalid character?
Thanks again.
According tothis thread, you might want to try:
ScriptManager.RegisterHiddenField(myUpdatePanel,"__EVENTTARGET", "btnSubmit");
hello again.
can't you put a simple page with2 or 3 buttons + the code that reproduces this problem? I'm still not convinced about the cause of therror being that event registration.
Well, I'm a little frustrated because the sample sites I put together both worked (including the above code). I'm not sure what else I'm missing. All I know is that on my production site - this works:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
txtUserID.Focus()
Status.Text = ""
Visibility(False)
End Sub
And this doesn't:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ClientScript.RegisterHiddenField("__EVENTTARGET", "btnSubmit")
txtUserID.Focus()
Status.Text = ""
Visibility(False)
End Sub
Anyone see anything obvious?
Did you try the my suggestion?
No. The purpose of the code was to set the default "enter key" button to btnSubmit. I ended up using the defaultbutton property of a panel, however, I never knew about scriptmanager.registerhiddenfield - so your suggestion was helpful. Thank you!
Hi celldss,
I was having this problem too, and this thread helped me by showing me where the problem was:
ScriptManager.RegisterHiddenField() or ClientScript.RegisterHiddenField() orPage.RegisterHiddenField()
I think the solution will have you kicking yourself -
I found that it worked for me if I called the RegisterHiddenField() only on the first page load, and not on subsequent postbacks! I guess it tries to register the same field on each postback otherwise. So my code is:
protected void Page_Load(object sender, EventArgs e) {if (!this.IsPostBack) { ScriptManager.RegisterHiddenField(this.updatePanel,"__EVENTTARGET","ButtonName"); } }I hope this works for you!
No comments:
Post a Comment