1.在后台中的显示添加或修改后的提示信息(提示之后刷新当前页)
ShowMsgHelper.AlertMsg("操作成功!");
2.提示信息的原函数
top.main.windowload();//javascript中的刷新页面代码
public static void AlertMsg(string message)
{
ShowMsgHelper.ExecuteScript(string.Format("showTipsMsg('{0}','2500','4');top.main.windowload();OpenClose();", message));
}
3.将后台的代码反应到前台的JS代码中
public static void ExecuteScript(string scriptBody)
{
string scriptKey = "Somekey";
Page p = HttpContext.Current.Handler as Page;
p.ClientScript.RegisterStartupScript(typeof(string), scriptKey, scriptBody, true);
}
4.FunctionJS.js中的相关代码
//回调
function windowload() {
rePage();
}
/**
刷新页面
**/
function rePage() {
Loading(true);
window.location.href = window.location.href.replace('#', '');
return false;
}
/**
短暂提示
msg: 显示消息
time:停留时间ms
type:类型 4:成功,5:失败,3:警告
**/
function showTipsMsg(msg, time, type) {
top.ZENG.msgbox.show(msg, type, time);
}