One of our ASP.NET WebForms 3.5 pages just suddenly decided not to render the __doPostBack()
javascript method, along with the supporting <hidden>
fields, anymore.
Everything else seems OK on the page - the only thing I changed was that I removed a postback handler on a SelectList
control, and changed AutoPostback
from True
to False
on the same control. There are still several other (unchanged) elements on the page that have postback handlers.
I'm also using jQuery validation on the page, but it was working like a charm before, and I haven't changed anything in the javascripts. And yes, I've seen this question, but that solution does not apply to me - we're not using any caching at all at the moment.
UPDATE:
It seems that ASP.NET is deciding my client scripts aren't needed, since no controls are depending on postback. However, I have a button control for submitting, which has an event handler on the server side, and that event handler is never called - I suspect this is because the button is allowed to be just a regular <input type="submit">
and submitting the form in standard HTTP ways, instead of with the ASP.NET __doPostBack
script.
This is my control (visible is set to True
in code-behind):
<asp:Button ID="SaveNewButton" runat="server" CssClass="inputbutton"
Visible="false" OnClick="SaveNewButton_Click" />
And this is the handler method in code-behind:
Protected Sub SaveNewButton_Click(ByVal sender As Object,
ByVal e As System.EventArgs) Handles SaveNewButton.Click
How do I force ASP.NET to render the client scripts for postbacks, so my event handler is called?