AjaxToolKit学习笔记 之 ModalPopupExtender

1.控件功能描述

以模式窗口的方式弹出客户或服务器控件,以突出显示! 弹出的一般是DIV或PANEL.

2.控件属性描述

TargetControlID : 触发弹出操作的控件ID.

PopupDragHandleControlID : 弹出层中可以拖动的层的控件ID. 就是"标题栏"层ID.

PopupControlID: 要弹出的层的ID.

BackgroundCssClass: 弹出层背景样式.

DropShadow: 是否在弹出层的边缘显示阴影.

OkControlID: 弹出层中确定按钮ID.

OnOkScript : 点击确定按钮的事件.

CancelControlID :弹出层中取消显示弹出层的控件ID.

OnCancelScript : 点击取消按钮的事件.

X,Y :指定弹出层的位置.

RepositionMode : 指示当页面窗口调整大小或滚动时,弹出层是否要进行位置移动.

 

3.功能演示

3.1 页面代码

 

ExpandedBlockStart.gif 代码
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--&gt < style  type ="text/css" >
.modalBackground 
{
    background-color
: Gray ;
    filter
: alpha(opacity=50) ;
    opacity
: 0.5 ;
} ;
.modalPopup 
{
    background-color
: White ;
    opacity
: 0 ;
}
style >

...

< div >
< asp:Button  runat ="server"  ID ="btnViewMore"  Text ="More"   />
        
< asp:Panel  ID ="pnlViewCustomer"  runat ="server"  CssClass ="modalPopup"  style ="display:none;" >  
            
< div  style ="margin:10px" >
                
< h1 > The service is not available in  < span  id ="Country" > span > . h1 >
                
< asp:Button  runat ="server"  ID ="viewBox_OK"  Text ="OK"   />
            
div >
        
asp:Panel >  
        
< ajaxToolkit:ModalPopupExtender  ID ="ModalPopupExtender2"  runat ="server"  
            TargetControlID
="btnViewMore"  Drag  ="true"
            PopupDragHandleControlID
="pnlViewCustomer"  
            PopupControlID
="pnlViewCustomer"
            BackgroundCssClass
="modalBackground"
            DropShadow
="false"
            OkControlID
="viewBox_OK" >
        
ajaxToolkit:ModalPopupExtender >

div >

 

 

4.试验过程中碰到的问题及原因

4.1 弹出层后,并没有屏蔽层以外的控件.

原因:没有设置BackgroundCssClass. 这个CSS是要自己写的. 如例子中的modalBackground.

4.2 设置BackgroundCssClass后,弹出层也显示成灰色.

原因:没有设置弹出层pnlViewCustomer的CSSCLASS. 这个CSS也是要自己写的. 如例子中的modalPopup.

5.总结

5.1 要达到模式弹出的效果,需要设置ModalPopupExtender的BackgroundCssClass样式,并在此样式中加上过滤效果!

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12639172/viewspace-662877/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/12639172/viewspace-662877/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值