0

I have UserControl that has few fields (address, suburb, etc) and a SubmitButton, once the Submit Button is pressed, a post back goes to the server and I save the details entered to a session to store it into the database at later stage.

All works fine on my local machine, and on my team members machines as well. However, once I deploy to the server, the Button Click does not work. When I click the button it posts back (reloads the page) but it never hits my event handler.

I had few validation on the page. I tried removing them all and still did not help. I Suspected server settings, so I deployed to another server (GoDaddy and CrazyDomains) and the same problem happens.

To make it more complicated, in few instances, it works on the Server fine. I am running .NET 4.0 and VS 2010

Any help would be highly appreciated. Thanks

<div class="clear" style="padding-top: 20px;">
  <asp:Button runat="server" 
              ID="SubmitButton" 
              OnClick="SubmitButtonClick" 
              Text="View Plans" 
              Width="150px" 
              CssClass="NextButton CompareButton"/>
</div>

The event handler

protected void SubmitButtonClick(object sender, EventArgs e)
{
  // doing my form data saving here 
  // not hitting this point
  Response.Redirect("http://google.com");
}
Konrad Viltersten
  • 36,151
  • 76
  • 250
  • 438
Has AlTaiar
  • 4,052
  • 2
  • 36
  • 37
  • have a look at this question: http://stackoverflow.com/questions/7495486/button-click-event-not-firing-within-use-control-in-asp-net –  Sep 11 '12 at 14:15
  • tried this before and it does not seem to make any difference. I can see that the User controls are loaded and even when I do what is said in that post, still does not make any difference. – Has AlTaiar Sep 11 '12 at 14:30
  • All controls have an ID (including the UserControl)? – Alessandro Sep 11 '12 at 15:03
  • Thanks for the comments guys. Yes, all the controls have ID specified, including the UserControl, and I have tried moving everything to the page instead of the UserControl and the Click Event is wiring – Has AlTaiar Sep 13 '12 at 12:22

1 Answers1

0

I found the issue was that we forgot to switch off the tracing tag in the Web.Config

 <trace enabled="true" requestLimit="40" localOnly="false" Output="false" />

So although it was working locally (because it was in Debug mode) it did not work on the server

The other issue was, because we were using these pages in iFrames we need to avoid

 Response.Redirect()

And needed to add a privacy policy to the pages so that they can be trusted by Web browsers, like this:

 response.addHeader("P3P","CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"")

Hope this can be of some help to somebody else

Has AlTaiar
  • 4,052
  • 2
  • 36
  • 37