前台调用:
<script type="text/javascript">
function ShowInfo() {
SP.UI.Notify.addNotification("操作成功!", false, "", null)
}
</script>
Html代码:
<a href="Javascript:ShowInfo();">测试通知前台</a>
后台调用:
protected void Button1_Click(object sender, EventArgs e)
{
ShowInfo("本次操作成功!");
}
private void ShowInfo(string msg)
{
if (!Page.ClientScript.IsStartupScriptRegistered("showStatus"))
{
Page.ClientScript.RegisterStartupScript(typeof(string), "showStatus", "ExecuteOrDelayUntilScriptLoaded(function() {SP.UI.Notify.addNotification('" + msg + "', false, '', null); }, 'sp.js');", true);
}
}