ajaxToolkit:ModalPopupExtender演示及实现代码

所属分类: 网络编程 / ASP.NET 阅读数: 614
收藏 0 赞 0 分享
ajaxToolkit:ModalPopupExtender可以让用户模拟新开一个窗口,以下演示,就是在模拟新开窗口作多项选项的功能。
 
演示例子中,是Repeater结合CheckBox进行多选,此功能实现,可以参考:https://www.jb51.net/article/33558.htm

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

<img id="ab" runat="server" style="margin-left: 5px; margin-bottom: 30px;"
src="../Image/ab.gif" width="18" height="18" />

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

<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样式
复制代码 代码如下:

/*Modal Popup*/
.modalBackground
{
background-color: Gray;
filter: alpha(opacity=70);
opacity: 0.7;
}
更多精彩内容其他人还在看

asp.net开发微信公众平台之获取用户消息并处理

这篇文章主要介绍了asp.net开发微信公众平台之获取用户消息并处理的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

asp.net开发微信公众平台之验证消息的真实性

这篇文章主要介绍了asp.net开发微信公众平台之验证消息的真实性的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

ASP.NET检测到不安全 Request.Form 值解决方案汇总

这篇文章主要介绍了ASP.NET检测到不安全 Request.Form 值解决方案汇总 ,十分的全面,需要的朋友可以参考下
收藏 0 赞 0 分享

ASP.NET中实现Form表单字段值自动填充到操作模型中

这篇文章主要介绍了ASP.NET中实现Form表单字段值自动填充到操作模型中,本文模仿MVC模式中的自动映射表单了模型,使用泛型和反射实现,需要的朋友可以参考下
收藏 0 赞 0 分享

ASP.NET中实现根据匿名类、datatable、sql生成实体类

这篇文章主要介绍了ASP.NET中实现根据匿名类、datatable、sql生成实体类,这个小小工具类非常实用,使用起来也很方便,需要的朋友可以参考下
收藏 0 赞 0 分享

ASP.NET中实现把form表单元素转为实体对象或集合

这篇文章主要介绍了ASP.NET中实现把form表单元素转为实体对象或集合,本文又是一个对重复数据处理的一个封装,非常实用的开发技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

ASP.NET实现的简单易用文件上传类

这篇文章主要介绍了ASP.NET实现的简单易用文件上传类,本文给出实现代码和使用方法示例,需要的朋友可以参考下
收藏 0 赞 0 分享

ASP.NET简单好用功能齐全图片上传工具类(水印、缩略图、裁剪等)

这篇文章主要介绍了ASP.NET简单好用功能齐全图片上传工具类(水印、缩略图、裁剪等),本文直接给出实现代码,需要的朋友可以参考下
收藏 0 赞 0 分享

简单好用的ASP.NET分页类(支持AJAX、自定义文字)

这篇文章主要介绍了简单好用的ASP.NET分页类(支持AJAX、自定义文字),本文直接给出实现代码和使用方法,需要的朋友可以参考下
收藏 0 赞 0 分享

支持ASP.NET MVC、WebFroM的表单验证框架ValidationSuar使用介绍

这篇文章主要介绍了支持ASP.NET MVC、WebFroM的表单验证框架ValidationSuar使用介绍,本文详细讲解了使用步骤,并给出一个完整Demo下载,需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多