Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在 MasterPage.cs 中的 page_load 方法之前调用一个 javascript 脚本。
我需要这样做,因为我想恢复将在 page_Load 方法中使用的 javascript 变量。
有人知道怎么做吗?
谢谢,
昆汀
在 Page_Load 开始或在 Page_Init 方法中,您可以调用 javascript,如:
ClientScriptManager cs = Page.ClientScript; cs.RegisterStartupScript(this.Page.GetType(), "TestKey", "YourJavascriptMethod();", true);