如何在asp.net 的updatepanel 中从后端调用javascript 函数。
ScriptManager.RegisterStartupScript(this,yourUpdatePanel.getType(),"Your js",true);
Its not hard to do, but it's depends on you, how you can call a method/function,
1) without update panel
function welcome() { alert("Welcome Guys!"); } protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(Page.GetType(), "OnLoad", "welcome();", true); }
2) With update panel
function welcome() { alert("Welcome Guys!"); } protected void Page_Load(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(Page, GetType(), "JsStatus","welcome();", true); }
both are perfectly works ;)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.