为了账号安全,请及时绑定邮箱和手机立即绑定

ajaxToolkit:ModalPopupExtender演示与应用

标签:
JavaScript

ajaxToolkit:ModalPopupExtender可以让用户模拟新开一个窗口,以下演示,就是在模拟新开窗口作多项选项的功能。


 

 演示例子中,是Repeater结合CheckBox进行多选,此功能实现,可以参考:http://www.cnblogs.com/insus/archive/2011/09/07/2169742.html

选择的小图片,它将要被ajaxToolkit:ModalPopupExtender使用,因为需要设为服务控件,添加runat="server":

5acf07360001405b00110016.jpgView Code <img id="ab" runat="server" style="margin-left: 5px; margin-bottom: 30px;"
                                    class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="../Image/ab.gif" width="18" height="18" />

 

下面是Popup窗口的Html,不过Insus.NET已经省略了Repeater控件内的内容,你在应用时,需要添加的你自己的,还是就是btnSelected_Click事件。

5acf07360001405b00110016.jpgView Code  <asp:Panel ID="pnlPopupWindown" runat="server" Style="display: none; background-color: #ffffdd;
                                border-width: 3px; border-style: solid; border-color: Gray; padding: 3px; width: 500px;">
                                <asp:Panel ID="Panel3" runat="server" Style="float: left; margin-bottom: 5px; cursor: move;
                                    background-color: #DDDDDD; border: solid 1px Gray; color: Black; height: 20px;
                                    width: 475px; text-align: center; line-height: 20px;">
                                    邮件地址列表
                                </asp:Panel>
                                <asp:Panel ID="Panel4" runat="server" Style="float: right; margin-bottom: 5px; background-color: #DDDDDD;
                                    border: solid 1px Gray; color: Black; height: 20px; text-align: center; line-height: 20px;">
                                    <asp:LinkButton ID="btnClose" runat="server" Style="margin-right: 4px; margin-left: 4px;"
                                        OnClientClick="return false;" Text="×" ForeColor="Red" ToolTip="Close" />
                                </asp:Panel>
                                <div>
                                    <asp:Panel ID="Panel1" runat="server" ScrollBars="Vertical" Height="198px" Width="100%"
                                        BorderStyle="Solid" BorderWidth="1px" BorderColor="Gray">
                                        <asp:Repeater ID="RepeaterEmailList" runat="server">
                                            
                                        </asp:Repeater>
                                    </asp:Panel>
                                    <div style="height: 3px;">
                                    </div>
                                    <asp:Panel ID="Panel2" runat="server">
                                        <asp:Button ID="btnSelected" runat="server" OnClick="btnSelected_Click" Text="插入"
                                            CausesValidation="false" CssClass="button" />
                                    </asp:Panel>
                                </div>
                            </asp:Panel>
                            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="ab"
                                PopupControlID="pnlPopupWindown" BackgroundCssClass="modalBackground" CancelControlID="btnClose"
                                DropShadow="true" PopupDragHandleControlID="Panel3" />
                            <script type="text/javascript">
                                function setBodyHeightToContentHeight() {
                                    document.body.style.height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) + "px";
                                }
                                setBodyHeightToContentHeight();
                                $addHandler(window, "resize", setBodyHeightToContentHeight);    
                            </script>

 

最后是CSS样式:

5acf07360001405b00110016.jpgView Code /*Modal Popup*/
.modalBackground
{
    background-color: Gray;
    filter: alpha(opacity=70);
    opacity: 0.7;
}

 

点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消