ModalPopUp扩展器 [英] ModalPopUp Extender

查看:115
本文介绍了ModalPopUp扩展器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用C#在ASP.NET中使用ModalPopUpExtender

How to Use ModalPopUpExtender in asp.net using C#

推荐答案

在aspx页面中:

首先添加ajax工具包,并在aspx页面中注册为:

<%@注册程序集="AjaxControlToolkit"命名空间="AjaxControlToolkit" TagPrefix ="cc1"%>


然后添加

In the aspx page:

First add ajax toolkit and register in the aspx page as:

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


then add

<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </cc1:ToolkitScriptManager>



然后:



and then:

<asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
                                <cc1:ModalPopupExtender TargetControlID="btnShowPopup" ID="pnlModal_ModalPopupExtender"

                                    runat="server" DynamicServicePath="" Enabled="True" BackgroundCssClass="modalBackground"

                                    PopupControlID="pnlModal" CancelControlID="btnClose" DropShadow="true">
                                </cc1:ModalPopupExtender>





在此按钮中,显示为none的btnShowPopup用作伪造按钮.
以便从代码隐藏中调用ModalPopUpExtender.
否则,您可以将其用作,不显示任何内容.






in this button btnShowPopup with display none is used as fake button.
so that ModalPopUpExtender is called from Code Behind.
otherwise you can use it as ,without display none.


<asp:Panel ID="pnlModal" runat="server" Height="99px" Width="368px">
                                    <table class="mainModalTable" cellpadding="0" height="98px" cellspacing="0" width="368px">
                                        <tr>
                                            <td class="mainModaTableTD">
                                                <table class="mainModalInnerTable" cellspacing="0" cellpadding="0" height="98px"

                                                    width="368px">
                                                    <tr>
                                                        <td class="mainModalInnerTableTD">
                                                            <table border="0" cellspacing="0" cellpadding="4" style="width: 368px" height="98px">
                                                                <tr>
                                                                    <td class="mainModalDraggablePanelTD" align="left">
                                                                        <asp:Panel CssClass="mainModalDraggablePanel" ID="MPD" runat="server">
                                                                            <span class="mainModalTitle" id="spanTitle">
                                                                                <asp:Label ID="lblShowPopUpMsg" runat="server" Font-Size="10px" Text="" ForeColor="White"></asp:Label>
                                                                            </span>
                                                                        </asp:Panel>
                                                                    </td>
                                                                    <td align="right" class="mainModalDraggablePanelCloseTD">
                                                                        <asp:ImageButton SkinID="CloseModal" runat="server" ID="clB" ImageUrl="~/Image/close.gif" />
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td class="mainModalContentsTD" colspan="2" align="center">
                                                                        <div id="Div3">
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td class="mainModalContentsTD" colspan="2" align="center">
                                                                        <div id="mainModalContents">
                                                                            <asp:Label runat="server" ID="lblModalPopUp" Font-Bold="true" ForeColor="#3A6EA5" Text="Are you sure to update all assets at once."></asp:Label>
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td class="mainModalContentsTD" colspan="2">
                                                                        <div id="Div1">
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td class="mainModalContentsTD" colspan="2" align="center">
                                                                        <div id="Div2">
                                                                            <asp:Button ID="btnDone" runat="server" Text="Done" OnClick="btnDone_Click" CausesValidation="false"

                                                                                CssClass="asset-viewer-btn" />&nbsp;&nbsp;
                                                                            <asp:Button ID="btnClose" runat="server" Text="Close" CausesValidation="false" CssClass="asset-viewer-btn" />
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>






这是用于ModalPopUp扩展器的面板.
您可以编辑您要使用的内容.



在后面的代码中:







this is the panel used for the ModalPopUp extender.
You can edit it what u want to use.



in the code behind:


protected void btnSaveAllRecords_Click(object sender, EventArgs e)
    {
       
            
            lblShowPopUpMsg.Text = "The page at " + Request.Url.GetLeftPart(UriPartial.Authority) + " says...";
            pnlModal_ModalPopupExtender.Show();
            //UpdateAllTableData();
       
    }




lblShowPopUpMsg.Text =& quot;位于& quot的页面; + Request.Url.GetLeftPart(UriPartial.Authority)+& quot;说...& quot;

此标签为您提供了网址的左侧部分.

就是全部.
您可以按照自己的方式使用它..


谢谢




lblShowPopUpMsg.Text = &quot;The page at &quot; + Request.Url.GetLeftPart(UriPartial.Authority) + &quot; says...&quot;;

this label gives you the left part of the url.

thats all.
you can use it in your way..


thanks


这篇关于ModalPopUp扩展器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆