在asp.net web应用程序的消息框 [英] message box in asp.net web application
问题描述
如何使用JavaScript来显示asp.net web应用保存成功的消息框。
how to display the 'successfully saved' message box in asp.net web application by using javascript.
任何想法???
推荐答案
而不是注册的一些JavaScript code是这样的:
Instead of registering a some JavaScript code like this:
Response.write("<script>ShowMessage('Successfully saved !');</script>");
这是一个有点清洁使用这种内置的方法:
it is a bit cleaner to use this built-in method:
Page.ClientScript.RegisterStartupScript(this.GetType(), "showMyMessage", "ShowMessage('Successfully saved!');", true);
这是比使用更清洁的Response.Write一点,它会自动prepends和附加的code'&LT;脚本类型=文/ JavaScript的&GT;'和'&LT; / SCRIPT&GT;
This is a bit cleaner than using Response.Write and it automatically prepends and appends your code with '<script type="text/javascript">' and '</script>'.
在您的ShowMessage(MyMessage)功能,你可以做一个简单的警告(),或者你可以做类似T.J.克劳德建议。
In your ShowMessage(MyMessage) function you could do a simple alert() or you could do something like T.J. Crowder suggests.
这篇关于在asp.net web应用程序的消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!