回发后调用vbscript [英] Call vbscript after postback

查看:73
本文介绍了回发后调用vbscript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的专家,我如何在页面回发后调用vbscript或javascript

我想在服务器端单击按钮时将"div"导出为ex​​cel格式,但是我的vbscript在填充"div"之前执行.我想在页面回发后执行它.

Dear experts how can i call vbscript or javascript after page postback

I want to export my "div" to excel format on server side button click but my vbscript executes before filling "div". I want to execute it after page postback.

推荐答案

请在导致回发的事件或函数中添加以下代码.

Please add the following code to the event or function that causes the postback.

ScriptManager.RegisterStartupScript(Me.Page, Me.GetType, "CallScriptAfterPostback", "<script language=''javascript''>MyJavascriptFunctionHere();</script>", False)



已添加:您可以保留除MyJavascriptFunctionHere()之外的所有内容;因为那代表您要在回发后调用的javascript函数.所以说:



Added: you can retain everything except for MyJavascriptFunctionHere(); because that represent the javascript function that you want to call after postback. so let say:

protected void MyButton_Click(object sender, EventArgs e)
{
   //other codes here....
   ScriptManager.RegisterStartupScript(this.Page, this.GetType, "CallScriptAfterPostback", "<script language=''javascript''>MyJavascriptFunctionHere();</script>", False)
}



>>请使用以下语言:language =''javascript''而不是language ="''javascript''.我不知道为什么单引号的前缀是''



>> please use this: language=''javascript'' instead of language="''javascript''". I don''t know why single quote has a prefix of "''


这篇关于回发后调用vbscript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆