ModalPopupExtender没有显示

时间:2014-08-19 10:16:37

标签: asp.net visual-studio-2012 ajaxcontroltoolkit modalpopupextender

我想在点击按钮时显示ModalPopupExtender,但弹出窗口没有显示。

我的代码:

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

<%@ Register assembly="DevExpress.Web.v14.1, Version=14.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style type="text/css">
        .Background
        {
            background-color: Black;
            filter: alpha(opacity=90);
            opacity: 0.8;
        }
        .Popup
        {
            background-color: #FFFFFF;
            border-width: 3px;
            border-style: solid;
            border-color: black;
            padding-top: 10px;
            padding-left: 10px;
            width: 400px;
            height: 350px;
        }
        .lbl
        {
            font-size:16px;
            font-style:italic;
            font-weight:bold;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
    <div>

        <dx:ASPxButton ID="bt_filtre1" runat="server" Text="Filtre 1">
        </dx:ASPxButton>
        <dx:ASPxButton ID="bt_filtre2" runat="server" Text="Filtre 2">
        </dx:ASPxButton>
        <dx:ASPxButton ID="bt_addFiltre" runat="server" OnClick="bt_addFiltre_Click" Text="+">
        </dx:ASPxButton>
        <cc1:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panl1" TargetControlID="bt_addFiltre"
            CancelControlID="bt_annuler" BackgroundCssClass="Background" BehaviorID="mp1">
        </cc1:ModalPopupExtender>
        <asp:Panel ID="Panl1" runat="server" style = "display:none">
            <iframe style=" width: 350px; height: 300px;" id="irm1" src="addFiltre.aspx" runat="server"></iframe>
        </asp:Panel>   
        <dx:ASPxButton ID="bt_gestionFiltres" runat="server" OnClick="bt_gestionFiltres_Click" Text="Gérer les filtres">
        </dx:ASPxButton>

    </div>
    </form>
</body>
</html>

并且:

    protected void bt_addFiltre_Click(object sender, EventArgs e)
    {
        mp1.Show();
    }

addFiltre.aspx是我的ModalPopupExtender的界面。 他包含两个TextEdit,一个ComboBox和两个Buttons。

为什么弹出窗口没有显示?

1 个答案:

答案 0 :(得分:0)

您也可以尝试在按钮中使用commandName。

<dx:ASPxButton ID="bt_addFiltre" runat="server" commandName="showPopUp" OnClick="bt_addFiltre_Click" Text="+">

.Net

  Protected Sub bt_addFiltre_Click(sender As Object, e As EventArgs)
select case e.commandName
   Case "showPopUp"
         mp1.show();
   End Select
 End Sub

C#

protected void bt_addFiltre_Click(object sender, EventArgs e)
{
switch (e.commandName) {
case "showPopUp":
    mp1.show();
    break;

}     }