C# – LinkButton not firing on production server

asp.netc

This is a good candidate for the "Works on My Machine Certification Program".

I have the following code for a LinkButton…

<cc1:PopupDialog ID="pdFamilyPrompt" runat="server" CloseLink="false" Display="true">
  <p>Do you wish to upgrade?</p>
  <asp:HyperLink ID="hlYes" runat="server" Text="Yes" CssClass="button"></asp:HyperLink>
  <asp:LinkButton ID="lnkbtnNo" runat="server" Text="No" CssClass="button"></asp:LinkButton>
</cc1:PopupDialog>

It uses a custom control that simply adds code before and after the content to format it as a popup dialog. The Yes button is a HyperLink because it executes javascript to hide the dialog and show a different one. The No button is a LinkButton because it needs to PostBack to process this value.

I do not have an onClick event registered with the LinkButton because I simply check if IsPostBack is true. When executed locally, the PostBack works fine and all goes well. When published to our Development server, the No button does nothing when clicked on. I am using the same browser when testing locally versus on the development server.

My initial thought is that perhaps a Validator is preventing the PostBack from firing. I do use a couple of Validators on another section of the page, but they are all assigned to a specific Validation Group which the No LinkButton is not assigned to. However the problem is why it would work locally on not on the development server.

Any ideas?

Best Answer

Check the html that is emitted on production and make sure that it has the __doPostback() and that there are no global methods watching click and canceling the event. Other than that if you think it could be related to validation you could try adding CausesValidation or whatever to false and see if that helps. Otherwise a "works on my machine" error is kind of hard to debug without being present and knowing the configurations of DEV vs PROD.

Related Topic