2016-03-26 1 views
0

Ich möchte dieses Popup-Formular immer noch anzeigen, wenn ich auf asp.net-Schaltfläche ID btnFindSales Derzeit schließen, wenn ich auf diese Schaltfläche klicken.Ich möchte Bootstrap modal immer noch anzeigen, wenn ich auf asp.net button klicken

<div class="modal fade" id="squarespaceModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true"> 
    <div class="modal-dialog"> 
    <div class="modal-content"> 
     <div class="modal-header"> 
      <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> 
      <h3 class="modal-title" id="lineModalLabel">List of Sales Employee</h3> 
     </div> 
     <div class="row criteria-box"> 
      <div class="col-md-6 criteria-item"> 
       <asp:DropDownList CssClass="form-control" style="max-width:280px;" ID="ddlFindOption" runat="server"> 
        <asp:ListItem>Slp Code</asp:ListItem> 
        <asp:ListItem>Sales Name</asp:ListItem> 
        <asp:ListItem>Position</asp:ListItem> 
       </asp:DropDownList> 
      </div> 
      <div class="col-md-6 criteria-item"> 
       <div class="input-group"> 
        <asp:TextBox CssClass="form-control" ID="txtFindSales" runat="server"></asp:TextBox> 
        <div class="input-group-btn"> 
         <asp:Button ID="btnFindSales" runat="server" Text="&#128270;" OnClick="btnFindSales_Click" CssClass="btn btn-primary" UseSubmitBehavior="false" data-dismiss="modal"/> 
        </div> 
       </div> 
      </div> 
     </div> 

     <div class="modal-body" style="padding-bottom:0;"> 
      <!-- content goes here --> 

     </div> 
    </div> 
    </div> 
</div> 

das Problem mit ASP-Schaltfläche ID btnFindSales. Bitte geben Sie mir einen Rat.

+1

Also 'btnFindSales_Click' ist eine serverseitige Methode richtig? Sie müssen entweder eine Logik aufrufen, die nach dem Postback ausgeführt wird, das Ihr Popup erneut öffnet, oder stattdessen diese Logik über einen AJAX-Aufruf ausführen. – mason

+0

@ Mason ist richtig. Ich denke, AJAX wäre die bevorzugte Methode, sonst müssten Sie etwas wie "RegisterStartupScript" tun, um das Modal wieder zu öffnen, wenn Ihr Klickereignis zurückschlägt. Deshalb ist es stinkend, Formulare in modalen Fenstern zu haben. – zgood

Antwort

0

Vielen Dank für die obigen Kommentare und ich fand Code, um es zu beheben.

ScriptManager.RegisterStartupScript(Page, Page.GetType(), "squarespaceModal", "$('#squarespaceModal').modal();", true); 

code oben ist für öffnen popup.

ScriptManager.RegisterStartupScript(Page, Page.GetType(), "squarespaceModal", "$('#squarespaceModal').modal('hide');", true); 

und dieses für close/hide popup.