两个模态弹出窗口不能一起工作asp.net

时间:2017-08-20 03:11:51

标签: asp.net modalpopupextender

我在页面中有两个模态弹出窗口。第一个弹出窗口按预期工作。然后我添加第二个弹出窗口,它正在工作,但第一个弹出窗口停止响应mp3.show()后面的代码。两个弹出窗口都是独立的,第二个是在datalist中。如果我删除第二个然后按预期工作。以下是代码。

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register TagPrefix="CP" TagName="TitleBar" Src="ucHeaderJobseeker.ascx" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>jQuery UI Autocomplete - Multiple values</title>
    <link href="~/Styles/StyleSheet.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css" />
    <script type="text/javascript">
        function ShowModalPopup() {
            var premium = document.getElementById("hdnPremium");
            // if (premium.value == "3") {
            $find("mpe").show();
            return false;
            //             }
            //             else
            //             { return true; }
        }
        function HideModalPopup() {
            $find("mpe").hide();
            return false;
        }
    </script>
</head>
<body style="margin: 0px 0px 0px 0px;">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div style="float: right;">
        <asp:LinkButton ID="lnkSignIn" runat="server" Text="sign in"></asp:LinkButton>
        <cc1:ModalPopupExtender ID="mp2" BehaviorID="behaviorIDmp1" runat="server" PopupControlID="Panel2"
            TargetControlID="lnkSignIn" CancelControlID="btnSignInCancel" BackgroundCssClass="modalBackground">
        </cc1:ModalPopupExtender>
        <asp:Panel ID="Panel2" runat="server" CssClass="modalPopup" align="center" Style="display: none;
            height: 230px; width: 300px;" DefaultButton="btnSignIn">
            <h1 style="font-variant: normal; font-family: Comic Sans MS; font-size: 1em; margin-left: 0px;
                margin-top: 0px; color: Gray;">
                Sign In</h1>
            <asp:Button ID="btnSignIn" Width="100px" Height="25px" runat="server" Text="OK" CausesValidation="false"
                Style="float: left;" />
            <asp:HyperLink ID="btnSignInCancel" runat="server" Text="Cancel" CssClass="btnClosePopup">Close</asp:HyperLink>
        </asp:Panel>
        <div style="float: right; margin-right: 20px; margin-top: 0px;">
            <div>
                <asp:HiddenField ID="hdnPremium" runat="server" Value="0" />
                <asp:Label ID="lblUsername" runat="server" Visible="false" ForeColor="BLUE" Style="margin-top: 0px;
                    float: right; margin-right: 10px;"></asp:Label></div>
            <asp:Label ID="lblPoints" runat="server" ForeColor="#CC0066" Style="float: left;"></asp:Label>
        </div>
    </div>
    <div style="float: right; display: block; margin-top: 10px; margin-right: 20px;">
        <asp:LinkButton ID="lnkReferSelected" Text="Refer Me in Selected Jobs" Visible="true"
            runat="server" OnClick="ReferMultiple" Style="background: #4E9CAF; padding: 5px 15px 5px 15px;
            text-align: center; border-radius: 5px; color: white; font-weight: bold; text-decoration: none;
            margin-left: 10px;"></asp:LinkButton>
        ​<%--<div class="divSignUp" id="divFakeReferSelected" runat="server" text="Refer Me in Selected Jobs"
                                            visible="true" style="background: #4E9CAF; padding: 5px 15px 5px 15px; text-align: center;
                                            border-radius: 5px; color: white; font-weight: bold; text-decoration: none; margin-left: 10px; cursor: pointer;">
                                            Refer Me in Selected Jobs</div>--%>
        <asp:LinkButton ID="lnkFakePay" runat="server" Style="display: none;"></asp:LinkButton>
        <cc1:ModalPopupExtender ID="mp3" BehaviorID="behaviorIDmp3" runat="server" PopupControlID="Panel3"
            TargetControlID="lnkFakePay" CancelControlID="hplCancelPay" BackgroundCssClass="modalBackground">
        </cc1:ModalPopupExtender>
        <asp:Panel ID="Panel3" runat="server" CssClass="modalPopup" align="center" Style="display: none;
            height: 230px; width: 300px;">
            <h1 style="font-variant: normal; font-family: Comic Sans MS; font-size: 1em; margin-left: 0px;
                margin-top: 30px; color: black; clear: both;">
                You are applying to more than</h1>
            <div style="text-align: center; margin-top: 30px; margin-bottom: 20px;">
                <asp:Button ID="btnPaymetConfirm" Width="100px" Height="25px" runat="server" Text="OK"
                    OnClick="btnPaymetConfirm_Click" CausesValidation="false" Style="float: left;" />
                <asp:HyperLink ID="hplCancelPay" runat="server" Text="Cancel" CssClass="btnClosePopup">Cancel</asp:HyperLink>
            </div>
        </asp:Panel>
    </div>
    <div style="width: 100%;">
        <asp:DataList ID="dlJobs" runat="server" RepeatDirection="Horizontal" RepeatColumns="1"
            DataKeyField="Job_Id" CellPadding="10" ItemStyle-VerticalAlign="Top" Width="100%"
            OnItemCommand="dlJobs_ItemCommand">
            <ItemTemplate>
                <div style="margin-top: 0px; padding-top: 10px; padding-bottom: 10px; background-color: White;
                    border: 1px solid #a6a6a6; width: 100%;">
                    <div style="float: left; margin-top: 10px; margin-left: 10px;">
                        <asp:CheckBox runat="server" ID="chkJob" />
                    </div>
                    <div style="float: left; margin-top: 10px; margin-left: 10px;">
                        <img alt="NoImage" src="Images/CompanyBlank.png" width="50px" height="50px" />
                    </div>
                    <div style="float: left; margin-top: 20px; margin-left: 10px;">
                        <asp:Label ID="lblCompany" Font-Bold="true" ForeColor="#004080" runat="server" Text='<%# Eval("Emp_Company").ToString() %>'></asp:Label>
                    </div>
                    <div style="margin-top: 20px; float: right; margin-right: 30px;">
                        <div style="color: #8b99a7; display: inline;">
                            Posted On:
                        </div>
                        <div style="display: inline;">
                            <asp:Label ID="lblPostDate" runat="server" Text='<%# Eval("Job_PostDate", "{0:dd-MMM-yyyy}") %>'
                                ForeColor="#21262c"></asp:Label></div>
                        <%--<div style="font-size: small; margin-left: 300px;">
                                                            <a href='Jobs.aspx?Job_Id=<%# Eval("Job_Id") %>'>View Details</a>
                                                        </div>--%>
                    </div>
                    <%--<div>
                                                        <asp:Label ID="lblJobTitle" Font-Bold="true" Font-Size="Small" Style="word-wrap: break-word;
                                                            word-break: break-all; cursor: default;" runat="server" Text='<%# Eval("Job_Title") %>'
                                                            ForeColor="#ffa366"></asp:Label>
                                                    </div>--%>
                    <div style="margin-top: 67px; margin-left: 40px;">
                        <div style="float: left; color: #8b99a7;">
                            IT Skill:&nbsp;</div>
                        <asp:Label ID="lblSkills" Style="margin-left: 40px;" Font-Bold="false" ForeColor="#21262c"
                            runat="server" Text='abc'></asp:Label>
                    </div>
                    <div style="margin-top: 7px; margin-left: 40px; float: left;">
                        <div style="float: left; color: #8b99a7;">
                            Experience:&nbsp;</div>
                        <asp:Label ID="lblExp" Style="margin-left: 15px;" Font-Bold="false" ForeColor="#21262c"
                            runat="server" Text='<%# Eval("Min_Exp").ToString() + " - " + Eval("Max_Exp").ToString() + " Years"%>'></asp:Label>
                    </div>
                    <div style="float: right;">
                        <asp:Panel ID="pnlRequestReferral" runat="server">
                            <div style="font-size: small; float: left;">
                                <asp:LinkButton ID="lnkReferSingleJob" Text="Refer Me" runat="server" CommandArgument='<%# Eval("Job_Id") %>'
                                    CommandName="ReferSingleJob" Style="background: #4E9CAF; padding: 5px 15px 5px 15px;
                                    text-align: center; border-radius: 5px; color: white; font-weight: bold; text-decoration: none;
                                    margin-left: 10px;" Visible='<%# Convert.ToBoolean(Eval("IsNotReferred")) %>'></asp:LinkButton>
                                <asp:Label runat="server" ID="lblReferred" Text="Referral Request Sent" ForeColor="#004080"
                                    Visible='<%# (int)Eval("IsNotReferred") == 1 ? false : true %>'></asp:Label>
                                <%--<div class="divSignUp" id="divReferMe" runat="server" style="background: #4E9CAF;
                                                                padding: 5px 15px 5px 15px; text-align: center; border-radius: 5px; color: white;
                                                                font-weight: bold; text-decoration: none; margin-left: 10px; cursor: pointer;">
                                                                Refer Me</div>--%>
                            </div>
                            <div style="font-size: small; float: right; margin-left: 20px;">
                                <asp:LinkButton ID="lnkContactReferrer" Text="Contact Referrer" OnClientClick="return ShowModalPopup()"
                                    runat="server" CommandArgument='<%# Eval("Job_Id") %>' CommandName="ContactReferrer"
                                    Style="background: #4E9CAF; padding: 5px 10px 5px 10px; text-align: center; border-radius: 5px;
                                    color: white; font-weight: bold; text-decoration: none; margin-left: 5px; margin-right: 5px;"></asp:LinkButton>
                                <asp:LinkButton ID="lnkDummy" runat="server" Style="display: none;"></asp:LinkButton>
                                <cc1:ModalPopupExtender ID="mp4" BehaviorID="mpe" runat="server" PopupControlID="pnlPopup"
                                    TargetControlID="lnkDummy" CancelControlID="btnHide" BackgroundCssClass="modalBackground">
                                </cc1:ModalPopupExtender>
                                <asp:Panel ID="pnlPopup" HorizontalAlign="Center" runat="server" CssClass="modalPopup"
                                    Style="display: none; height: 230px; width: 300px;">
                                    <div style="float: left;">
                                        Name :</div>
                                    <div style="color: Black;">
                                        <%# Eval("First_Name")%></div>
                                    <br />
                                    <div style="float: left;">
                                        Email :</div>
                                    <div style="color: Black;">
                                        <%# Eval("EmpEmail_Id")%></div>
                                    <br />
                                    <div style="float: left;">
                                        Contact :</div>
                                    <div style="color: Black;">
                                        <%# Eval("Contact_Number")%></div>
                                    <br />
                                    <br />
                                    <asp:Button ID="btnHide" runat="server" Text="Close" OnClientClick="return HideModalPopup()" />
                                </asp:Panel>
                            </div>
                        </asp:Panel>
                        <asp:Panel ID="pnlReferred" runat="server" Visible='<%# Convert.ToBoolean(Eval("IsNotReferred")) %>'>
                            <div style="font-size: small; float: left;">
                                <asp:Label ID="lblRefRequest" Text="Referral Request Sent" Visible="false" runat="server"
                                    Style="background: #4E9CAF; padding: 5px 15px 5px 15px; text-align: center; border-radius: 5px;
                                    color: white; font-weight: bold; text-decoration: none; margin-left: 10px;"></asp:Label>
                            </div>
                            <div style="font-size: small; float: right; margin-left: 20px;">
                                <asp:Label ID="lblRefContact" Visible="false" runat="server" Style="background: #4E9CAF;
                                    padding: 5px 15px 5px 15px; text-align: center; border-radius: 5px; color: white;
                                    font-weight: bold; text-decoration: none; margin-left: 10px;"></asp:Label>
                            </div>
                        </asp:Panel>
                    </div>
                    <div style="margin-top: 7px; margin-left: 40px; float: left; clear: both;">
                        <div style="float: left; color: #8b99a7;">
                            Location:&nbsp;</div>
                        <asp:Label ID="lblLocation" Style="margin-left: 25px;" Font-Bold="false" ForeColor="#21262c"
                            runat="server" Text='<%# Eval("Job_Location").ToString() %>'></asp:Label>
                    </div>
                    <%--<div style="margin-top: 10px; margin-left: 40px; margin-bottom: 20px;">
                                                    <div style="float: left; color: #8b99a7;">
                                                        Note:&nbsp;</div>
                                                    <asp:Label ID="lblNotice" style="margin-left: 50px;" Font-Bold="false" ForeColor="#21262c" runat="server"
                                                        Text='<%# Eval("Notice").ToString() %>'></asp:Label>
                                                </div>--%>
                    <div style="margin-top: 60px; margin-left: 40px; margin-bottom: 20px; clear: both;">
                        <div style="float: left; color: #8b99a7; display: inline;">
                            About Company:&nbsp;</div>
                        <asp:Label ID="lblAbtCompany" Style="margin-left: 10px; display: inline; margin-top: 20px;"
                            Font-Bold="false" ForeColor="#21262c" runat="server" Text='<%# Eval("About_Company").ToString() %>'></asp:Label>
                    </div>
                </div>
            </ItemTemplate>
        </asp:DataList>
    </div>
    </form>
</body>
</html>

这是

背后的代码

protected void Page_Load(object sender, EventArgs e)
    {
        string keySkills = "java";
        string location = string.Empty;
        int recordcount = 0;

        DataTable dtJobList;
        DataTable dtCompanyList;
        DataSet dsJobs = GetSearchResult(keySkills, location, 1, ref recordcount, Session["UserName"], 0);

        dtJobList = dsJobs.Tables[0];
        dtCompanyList = dsJobs.Tables[2];

        dlJobs.DataSource = dtJobList;
        dlJobs.DataBind();
    }

    


    protected void ReferMultiple(object sender, EventArgs e)
    {
        mp3.Show();
    }

    protected void btnPaymetConfirm_Click(object sender, EventArgs e)
    { }

    protected void dlJobs_ItemCommand(Object sender, DataListCommandEventArgs e)
    {
    }

这是完整的代码,如果我删除mp4模式弹出窗口,那么mp3将正常工作。

0 个答案:

没有答案