[英]How can i call javascript function from backend within updatepanel
如何在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 1) 没有更新面板
function welcome() { alert("Welcome Guys!"); } protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(Page.GetType(), "OnLoad", "welcome();", true); }
2) With update panel 2) 带更新面板
function welcome() { alert("Welcome Guys!"); } protected void Page_Load(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(Page, GetType(), "JsStatus","welcome();", true); }
both are perfectly works ;)两者都是完美的作品;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.