Reputation: 122
I need to call a javascript script before the page_load method in the MasterPage.cs.
I need to do this because I want to recover a javascript variable that will be used in the page_Load method.
Someone know how to do?
Thank you,
Quentin
Upvotes: 0
Views: 1853
Reputation: 2170
In start of Page_Load or in Page_Init method you can call javascript like:
ClientScriptManager cs = Page.ClientScript;
cs.RegisterStartupScript(this.Page.GetType(), "TestKey", "YourJavascriptMethod();", true);
Upvotes: 1