实际上,我需要显示Success Message
,然后点击OK
后,Redirect
我应该转到另一个Page
。
截至目前,一切正常。但在放置UpdatePanel
后,Alert
未显示。
我的代码:
ClientScript.RegisterStartupScript(typeof(Page), "Create Time Table", "<script language='JavaScript'>alert('Time Table Created Successfully.'); window.location.href = 'create.aspx';</script>");
我尝试过:
ClientScript.RegisterStartupScript(typeof(Page), "Create Time Table", "<script language='JavaScript'>alert('Time Table Created Successfully.'); window.location.href = 'create.aspx';</script>",true);
ClientScript.RegisterStartupScript(typeof(Page), "Create Time Table", "<script language='JavaScript'>alert('Time Table Created Successfully.'); window.location.href = 'create.aspx';</script>",false);
但是,这些都没有奏效:(
答案 0 :(得分:4)
如果您有更新面板,则提供更新面板ID及其类型如下
ScriptManager.RegisterStartupScript(
UpdatePanelID,
UpdatePanelID.GetType(),
"Create Time Table",
" alert('Time Table Created Successfully.'); window.location.href = 'create.aspx';",
true);