【发布时间】:2014-09-23 05:14:08
【问题描述】:
当网站上没有回发时,我需要通过代码隐藏调用 JS 函数。
我已经在结束<head>标签之前添加了我的脚本:
<script type="text/javascript">
function StartWidgetTour() {
//init the tour!
wWidgetTour.init();
//finally start the tour! strange but we have to restart.
wWidgetTour.restart();
}
</script>
我的代码如下:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Widget Tour Start!", "StartWidgetTour()", true);
//more code that already works
当我想运行这段代码时,我收到了一个构建错误The name 'ScriptManager' does not exist in the current context。
我已经在使用命名空间System.Web 和System.Web.UI;。
答案to this question 对我不起作用。
感谢您的帮助!
【问题讨论】:
标签: c# javascript asp.net namespaces