如何在asp.net的updatepanel中从后台调用javascript函数。
ScriptManager.RegisterStartupScript(this,yourUpdatePanel.getType(),"Your js",true);
它并不难做,但这取决于你,你如何调用一个方法函数。
1)没有更新面板
function welcome()
{
alert("Welcome Guys!");
}
protected void Page_Load(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(Page.GetType(), "OnLoad", "welcome();", true);
}
2) 有更新面板
function welcome()
{
alert("Welcome Guys!");
}
protected void Page_Load(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(Page, GetType(), "JsStatus","welcome();", true);
}
都是完美的作品;)