2013-08-26 26 views
1

實際上,我需要顯示Success Message,並且在點擊OK之後,它應該將Redirect me轉換爲另一個Page
Upto Now,Everything works fine.But放置UpdatePanel後,Alert未顯示。無法使用ClientScript.RegisterStartupScript在UpdatePanel中顯示警報

我的代碼:

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); 

但是,這些都不工作:(

回答

4

,如果你有更新面板給更新面板ID及其類型低於

ScriptManager.RegisterStartupScript(
       UpdatePanelID, 
       UpdatePanelID.GetType(), 
       "Create Time Table", 
       " alert('Time Table Created Successfully.'); window.location.href = 'create.aspx';", 
       true); 
+1

工程就像一個魅力: ) – RealSteel