我有一些代碼在OnInit的hanlderPage.ClientScript.RegisterStartupScript不起作用 - 爲什麼?
if (!Page.ClientScript.IsStartupScriptRegistered(GetType(), "MyScript"))
{
Page.ClientScript.RegisterStartupScript(GetType(), "MyScript", GetStartupScript(), true);
}
在這裏,我嘗試註冊一些Java腳本代碼。並且我希望它在按鈕單擊事件上工作。但它不執行。它只在刷新頁面後執行。任何人都可以解釋爲什麼它不執行?
thnx提前!
可能與頁面生命週期事件。你可以看看http://msdn.microsoft.com/en-us/library/ms178472(v=vs.80).aspx – Hoque 2012-04-28 15:20:06