如何在代码隐藏的某些条件下禁用整个页面
本文关键字:条件下 代码 隐藏 | 更新日期: 2023-09-27 18:01:04
我有一个特定的页面,我希望在按钮点击事件中,在某种情况下禁用所有控件并grayout
整个页面,显示一条信息消息,说明确认已完成。
如何以一般方式做到这一点?
你基本上想要一个面具。虽然不完全符合您的问题,但看看这个基于jQuery的负载掩码插件,您应该能够调整它以满足您的需求:
https://code.google.com/p/jquery-loadmask/
查看Ajax控制工具包中包含的模式弹出窗口:
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ModalPopup/ModalPopup.aspx
这将允许弹出一条消息,有效地阻止与页面其他部分的交互。
$(document).ready(function() {
if(Conditions satisfy){
$('#div_controls').attr('disabled', true);
$('#div_status').attr('disabled', false);}
else{ $('#div_controls').attr('disabled', false);
$('#div_status').attr('disabled', True)
}
});
In HTML
<div id="div_status"> Your Message with your styles </div>
<div id="div_controls"> Your Controls inside this Div </div>
在没有任何回复的情况下,WO丢失了数据,声明这是可以做到的。。
或者查看这个演示
http://www.zurb.com/playground/reveal-modal-plugin
用户点击后,您可以使所有控件"不可见">
foreach (Control c in Page.Controls)
c.Visible = false;
或者更好的方法是使用插件,如Modal UpdateProgress
在HTML 中
<div id="layer"></div>
<div id="container">
----
----
----
</div>
和CSS
#layer{
background: none repeat scroll 0 0 white;
height: 100%;
left: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 100000;
}
这将禁用该页面(或其行为类似于禁用(。