如何防止模式弹出窗口在单击的按钮上关闭

时间:2019-04-15 07:52:46

标签: c# asp.net

我正在做一个弹出窗口以显示人员详细信息并编辑详细信息,但是当我单击“编辑”按钮时,模式弹出窗口关闭了。

 

<div class="popup">

<label class="header">Staff Information</label> <asp:Button ID="btnClose" runat="server" Text="X" CssClass="btncls"/>

    <asp:Label runat="server" ID="lblStaffID" Text='<%#Eval("staffID").ToString() %>' Visible="false"></asp:Label>

<img class="profileImg" src="profileImg/<%#Eval("staffImg") %>"/>

<table>
    <tr>
        <td>Staff ID :</td>
        <td><%#"S"+Eval("staffID").ToString().PadLeft(4,'0') %></td>
    </tr>
    <tr>
        <td>Role :</td>
        <td><asp:Label runat="server" ID="lblRole" Text='<%# (Eval("roleID").ToString() == "MANG") ? "Manager" : ((Eval("roleID").ToString() == "STAF") ? "Operational Staff" : "Delivery Staff")%>'></asp:Label>
            <asp:DropDownList runat="server" Visible="false" ID="ddlRole">
                <asp:ListItem Value="MANG">Manager</asp:ListItem>
                <asp:ListItem Value="STAF">Operational Staff</asp:ListItem>
                <asp:ListItem Value="DSTF">Delivery Staff</asp:ListItem>
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td>Name :</td>
        <td><%#Eval("staffName")%></td>
    </tr>
    <tr>
        <td>Gender :</td>
        <td><%# (Eval("staffGender").ToString() == "M") ? "Male" : "Female"%></td>
    </tr>
    <tr>
        <td>Contact :</td>
        <td><%#Eval("staffContact")%></td>
    </tr>
    <tr>
        <td>Email :</td>
        <td><%#Eval("staffEmail")%></td>
    </tr>
    <tr>
        <td>Status :</td>
        <td><%# (Eval("staffStatus").ToString() == "1") ? "Active" : "Inactive"%></td>
    </tr>
</table>
    <asp:Button runat="server" ID="btnDelete" Text="Delete" OnClick="btnDelete_Click" Visible='<%# (Eval("staffStatus").ToString() == "0") ? false : true%>'/>
    <asp:Button runat="server" ID="btnRecover" Text="Recover" OnClick="btnRecover_Click" Visible='<%# (Eval("staffStatus").ToString() == "1") ? false : true%>'/>
    <asp:Button runat="server" ID="btnEdit" Text="Edit" OnClick="btnEdit_Click" ClientIDMode="Static" data-toggle="modal" data-target="#mp1" OnClientClick="return false" />
    <asp:Button runat="server" ID="btnUpdate" Text="Update" OnClick="btnUpdate_Click" Visible="false"/>
    <asp:Button runat="server" ID="btnCancel" Text="Cancel" OnClick="btnCancel_Click" Visible="false" />
    </div>

我通过添加以下代码改进了代码:

ClientIDMode="Static" data-toggle="modal" data-target="#mp1" OnClientClick="return false" 

它确实阻止了我的弹出窗口关闭,但是当我单击时编辑按钮没有运行后面的代码

0 个答案:

没有答案