locked
Update panel not working on server but fine on demo site on same instance of iis RRS feed

  • Question

  • User-183185495 posted

    For some reason my update panel will not work on the server it works local on our test server and local dev boxes. I have the following code for my update panel within a jquery model the demo and live site are on the same instance of iis.

    <div class="modal fade" id="myModal">
      <div class="modal-dialog">
        <div class="modal-content" style="text-align:left;">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span  style="display:none;" class="sr-only">Close</span></button>
            <h2 class="modal-title" align="center">10% Off Your Frist Order!</h2>
          </div>
          <div class="modal-body">
         <div class="clear"></div>
            <div class="input-group">
          <img src="" width="100%" alt="10% Off First Order" />
                <div style="float:left">
                   *excludes.</div> 
               <div ></div>
              <span class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span></span>
                <div style="clear:both;"></div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
          ContentTemplate>
                <asp:TextBox ID="txtEmail" placeholder="Enter Email for Discount"  CssClass="emailField"  runat="server"></asp:TextBox>
                        <br />
             <asp:label runat="server" id="lblVoucher"  style="font-size:16px;"></asp:label>
                        <asp:Label ID="lblblerror" runat="server"  ForeColor="Red"></asp:Label>
                    <asp:button runat="server" CausesValidation = "false" class="btn btn-primary  "   
    
                   ID ="btnNewGetVoucher"    style="background-color:#007B78;color:white;align-self:center;height:55px;width:100%"  text="Get Voucher Code" />
      </ContentTemplate>
         </asp:UpdatePanel>
    
       </div>
      </div>
      <div class="modal-footer">
        <!-- Make sure to include the 'nothanks' class on the buttons -->
    
       </div>
    </div><!-- /.modal-content -->

    Then my button handle event is as follows

     Protected Sub btnNewGetVoucher_Click(sender As Object, e As EventArgs) Handles btnNewGetVoucher.Click
    
    
     End Sub 

    The reason why I have my button inside the update panel is that I want it to disappear when the customer clicks get voucher but please if anybody think that is wrong way to do it please let me no.

    Note: I checked both web configs to make sure that the mode was not set to legacy and indeed it was commented out

    <!--<xhtmlConformance mode="Legacy" />-->
    

    Oh and the demo site and live site are on sep instances on the same iis so I no its not a case of its not installed.

    Just for extended clarity here is my code that calls the modal.

    <script  type="text/javascript">
    
            // Delayed Modal Display + Cookie On Click
            $(document).ready(function () {
    
                console.log("Popup Code");
    
    
                $('#myModal').on('hidden.bs.modal', function () {
                    // we want to trap the user closing the popup and we also set the cookie expiery here to seven days.
                    $.cookie('mycookie', 'true', { expires: 604800000, path: '/' });
                })
                //if the cooke when the modal has been created is empty then display
                //the second one is for 
                if ($.cookie("mycookie") == null) {
                    console.log("Popup Start");
                    // Show the modal, with delay func.
                    $('#myModal').appendTo("body");                
                    $("#myModal").appendTo("form:first");           
                    function show_modal() {
                        $.cookie('mycookie', 'true', { expires: 604800000, path: '/' });
                     $('#myModal').modal();
                        console.log("Popup Displayed after mymodal");
                    }             
                    // Set delay func. time in milliseconds
                    window.setTimeout(show_modal, 10000);
                }
    
    
    
    
            });
    </script>

     

    Wednesday, September 6, 2017 8:34 AM

All replies

  • User475983607 posted

    For some reason my update panel will not work on the server it works local on our test server and local dev boxes.

    What does "will not work" mean?  What's not working?

    Wednesday, September 6, 2017 10:31 AM
  • User-183185495 posted

    The update panel is not excuting the button click and doing the partial refresh its working on demo and local

    Wednesday, September 6, 2017 11:23 AM
  • User475983607 posted

    roguenidb

    The update panel is not excuting the button click and doing the partial refresh its working on demo and local

    What happens when the button is clicked?  Are you seeing a full post back as opposed to a partial?

    The content template tag is missing the starting <.

    Are there any JavaScript errors in the console?

    Why are you appending the modal to the body and the form element in JavaScript?  You'll end up with three copies of the modal.

    Wednesday, September 6, 2017 12:21 PM
  • User-183185495 posted

    Hi Sorry that was a formatting issue the, the button click does not happen for what should happen is the text box is made in visible and it runs my mail chimp code.

    ContentTemplate 
    Wednesday, September 6, 2017 2:20 PM
  • User-183185495 posted

    The point I am getting at is this codes works fine 100% in visual studio and the demo server which is same server as live 

    Wednesday, September 6, 2017 3:11 PM
  • User-707554951 posted

    Hi roguenidb,

    For your problem, I suggest you could open browser error console window to check if some error in it.

    You could try to add AsyncPostBackTrigger for update panel.

     <Triggers>
                    <asp:AsyncPostBackTrigger  ControlID="btnNewGetVoucher"  EventName="click"/>
                </Triggers>

    Best regards

    Cathy

    Thursday, September 7, 2017 6:50 AM