我可以在visual studio 2005中使用ajaxToolkit:ModalPopupExtender吗?

时间:2018-01-02 07:11:04

标签: asp.net visual-studio-2005 modalpopupextender

我有一个asp.net web形式的项目,它是在visual studio 2005中开发的。我正在尝试使用模态弹出窗口(使用ajaxToolkit:ModalPopupExtender),但是它没有工作。但它完美无缺。适用于vs2010。这让我感到困惑。是否有可能在vs2005中实现它。

2 个答案:

答案 0 :(得分:0)

是的,您可以尝试使用此代码 --add ajaxcontroltoolkit ---

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

- 选择按钮---

<asp:LinkButton Text="" ID="lnkFake" runat="server" />

---然后你拿这个代码---

 <ajaxToolkit:ModalPopupExtender ID="mpe" EnableViewState="true" runat="server" PopupControlID="pnlPopup"
                TargetControlID="lnkFake" CancelControlID="btnClose" BackgroundCssClass="modalBackground">
            </ajaxToolkit:ModalPopupExtender>
            <asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Width="50%" Style="display: none;
                background-color: lightsteelblue;">
                <asp:Label runat="server" ForeColor="Green" ID="lblModelShow" Font-Size="12px" Font-Bold="true"></asp:Label>
                <div style="display: block; overflow: auto; width: 100%; height: 700px; text-align: center"
                    class="textarea">
                    <div class="row">
                        <div id="Div1" style="overflow: scroll; height: 620px;">
                            <br />
                            <br />
                            <asp:GridView ID="GridView1" runat="server" Height="1px" Width="750px" CellPadding="4"
                                BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px">
                                <Columns>
                                    <asp:TemplateField HeaderText="SL">
                                        <ItemTemplate>
                                            <%#Container.DataItemIndex+1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                                <RowStyle CssClass="AlternatColor" Width="80px" ForeColor="#003399" />
                                <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                                <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" CssClass="AlternatColor" />
                                <HeaderStyle BackColor="#003399" BorderStyle="Double" Width="80px" Font-Bold="True"
                                    ForeColor="#CCCCFF" />
                            </asp:GridView>
                        </div>

---这是c#代码--- ---哪个事件明智,你可以尝试展示你的支柱----

 mpe.Show(); 

答案 1 :(得分:0)

还可以使用此:

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> 



<asp:LinkButton ID="lnkbutton" runat="server"></asp:LinkButton>
        <ajaxToolkit:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panel1" TargetControlID="lnkbutton"
            CancelControlID="btnClose" BackgroundCssClass="modalBackground">
        </ajaxToolkit:ModalPopupExtender>
        <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup " align="center" Style="display: none">
            <h2 style="color: #000; text-decoration: underline">
                <asp:Label ID="lblGridHeader" runat="server" Text="`enter code here`Points Redeem"></asp:Label></h2>
                <div>

                </div>
            <asp:Button ID="btnClose" runat="server" Text="Close" />
        </asp:Panel>

样式:

<style type="text/css">
        body {
            font-family: Arial;
            font-size: 10pt;
        }

        .modalBackground {
            background-color: #ccc;
            filter: alpha(opacity=90);
            opacity: .9;
        }

        .modalPopup {
            background-color: #fff;
            border: 3px solid #ccc;
            padding: 10px;
            width: 900px !important;

        }

        @-webkit-keyframes blinker {
            from {
                opacity: 1.0;
            }

            to {
                opacity: 0.2;
            }
        }

        .blink {
            text-decoration: blink;
            -webkit-animation-name: blinker;
            -webkit-animation-duration: 0.8s;
            -webkit-animation-iteration-count: infinite;
            -webkit-animation-timing-function: ease-in-out;
            -webkit-animation-direction: alternate;
        }

        .modal {
            position: fixed;
            top: 0;
            left: 0;
            background-color: #0000009e;
            z-index: 500;
            opacity: 1;
            filter: alpha(opacity=80);
            min-height: 100%;
            width: 100%;

        }

        .modal-backdrop {
            position: fixed;
            top: auto;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: 1040;
            background-color: #000;
        }

        .modal-dialog {
            width: 1220px;
        }
    </style>