使用ModalPopupExtender实现弹出式窗口

 

1,添加script manager 2,添加ModalPopupExtender 3,转到代码页,设置以下属性:
<cc1:ModalPopupExtender ID="ModalPopupExtender"                TargetControlID="LinkButton3"             PopupControlID="Panel1"              BackgroundCssClass="modalBackground"              OkControlID="OkButton"                   CancelControlID="CancelButton"               OnOkScript="onclick();"             DropShadow="true"             PopupDragHandleControlID="Panel3"  runat='server'/>  
targetcontrolID 是你点击的控件 PopupControlID 是弹出的窗口控件 BackgroundCssClass 是你的背景样式表 ... PopupDragHandleControlID 是你拖动Panel的区域控件
    <asp:Panel ID="Panel1" runat="server" Style="display: none" CssClass="modalPopup">             <asp:Panel ID="Panel3" runat="server" Style="cursor: move;background-color:#DDDDDD;border:solid 1px Gray;color:Black">                 <div>                     <p>添加标签页</p></div>              </asp:Panel>                 <div><br />                 <>标签页名称:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></p><br />                    <style="text-align: center;">                         <asp:Button ID="OkButton" runat="server" Text="OK" />                         <asp:Button ID="CancelButton" runat="server" Text="Cancel" />                     </p>                 </div>                     </asp:Panel>
css文件:
/*Modal Popup*/ .modalBackground {     background-color:Gray;     filter:alpha(opacity=70);     opacity:0.7; } .modalPopup {     background-color:#ffffdd;     border-width:3px;     border-style:solid;     border-color:Gray;     padding:3px;     width:250px; } .sampleStyleA {     background-color:#FFF; } .sampleStyleB {     background-color:#FFF;     font-family:monospace;     font-size:10pt;     font-weight:bold; } .sampleStyleC {     background-color:#ddffdd;     font-family:sans-serif;     font-size:10pt;     font-style:italic; } .sampleStyleD {     background-color:Blue;     color:White;     font-family:Arial;     font-size:10pt; }
css引用:
  <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值