开发者

How can i call javascript function from backend within updatepanel

How can I call javascript function from backend within updatepanel in as开发者_Python百科p.net.


ScriptManager.RegisterStartupScript(this,yourUpdatePanel.getType(),"Your js",true);

see http://msdn.microsoft.com/en-us/library/bb310408.aspx


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 ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜