asp.net 网站中的消息框
using (DataServer server = new DataServer())
{
server.ExecuteNonQuery(CommandType.Text, updateuser, param);
}
MessageBox.Show("User succesfully updated");
我有一个更新按钮,当字段更新时我显示一个消息框,但问题是消息框位于浏览器后面。我必须最小化浏览器才能关闭消息框,同时我能够在不关闭消息框的情况下在网站中导航,我想在显示消息框时模糊网站中的剩余区域。我怎样才能在我的网站上做到这一点。
using (DataServer server = new DataServer())
{
server.ExecuteNonQuery(CommandType.Text, updateuser, param);
}
MessageBox.Show("User succesfully updated");
I have a update button when The fields are updated I show a message box, but the problem is the message box is behind the browser. I have to minimize the browser to close the message box, at the same time I am able to navigate in the website without closing the message box, I want to blur out the remaing area in the website when the message box is displayed. How can I do this in my website.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这种情况下,您要么想用 JavaScript 发出警报,要么使用某种对话框。
要发出警报,您可以这样做:
至于使用对话框,我建议使用
ModalPopupExtender
或jQuery UI Dialog
。ModalPopupExtender:
http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/modalpopup/modalpopup.aspx
jQuery UI 对话框:
http://jqueryui.com/demos/dialog/
In this case you would either want to throw up an alert with JavaScript, or use a dialog of some sort.
To throw up an alert, you can do this:
As for using a dialog, I would suggest the
ModalPopupExtender
or thejQuery UI Dialog
.ModalPopupExtender:
http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/modalpopup/modalpopup.aspx
jQuery UI Dialog:
http://jqueryui.com/demos/dialog/
不要这样做。相反,发出客户端 JavaScript 来弹出警报对话框,或者添加一个用户可以单击以使其消失的 div。您还可以使用更合适的 UX 约定,添加一个消息 div,以非常特定的颜色简单地说明“记录已更新”或类似内容,以便用户知道要查找什么。
弹出消息框的想法听起来很诱人,但是将其放在服务器上并从浏览器中的单独框中点击它,您很快就会发现为什么这是一个极其糟糕的主意。
Don't do it this way. Instead, emit client side JavaScript to pop up an alert dialog, or add a div that a user can click to make it go away. You can also use a more proper UX convention of adding a message div that simply states "record updated" or similar, in a very specific color, so the user knows what to look for.
The idea of popping up a message box sounds tempting, but stick this out on a server and hit it from a browser on a separate box and you will quickly find out why this is an extremely bad idea.