开发者

Message box in asp.net website

开发者 https://www.devze.com 2023-04-09 09:36 出处:网络
using (DataServer server = new DataServer()) { server.ExecuteNonQuery(CommandType.Text, updateuser, param);
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.



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:

Page.ClientScript.RegisterStartupScript(GetType(), "UserDialogScript", "alert(\"User successfully updated\");", true);

As for using a dialog, I would suggest the ModalPopupExtender or the jQuery UI Dialog.

ModalPopupExtender:
http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/modalpopup/modalpopup.aspx

jQuery UI Dialog:
http://jqueryui.com/demos/dialog/


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消