asp.net – 多个RegisterClientScriptBlock
发布时间:2020-12-16 06:47:45 所属栏目:asp.Net 来源:网络整理
导读:我想在我的.cs文件上调用3个 javascript函数,我试过这个: protected void Page_Load(object sender,EventArgs e) { if (IsPostBack) { ClientScriptManager script = Page.ClientScript; ClientScriptManager script2 = Page.ClientScript; ClientScriptMan
我想在我的.cs文件上调用3个
javascript函数,我试过这个:
protected void Page_Load(object sender,EventArgs e) { if (IsPostBack) { ClientScriptManager script = Page.ClientScript; ClientScriptManager script2 = Page.ClientScript; ClientScriptManager script3 = Page.ClientScript; script.RegisterClientScriptBlock(this.GetType(),"key","centerPopup1()",true); script2.RegisterClientScriptBlock(this.GetType(),"loadPopup1()",true); script3.RegisterClientScriptBlock(this.GetType(),"msg1()",true); } } 没有成功,我的Postbacks没有任何反应,但如果我尝试只调用其中一个函数,它就可以了. 解决方法
我相信你只能注册一个StartupScript块和多个ClientScriptBlocks(不同的键)
而不是创造多个;让他们彼此相邻. 启动:将在表单中加载 script.RegisterClientScriptBlock(this.GetType(),"centerPopup1(); loadPopUp1(); msg1();",true); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
推荐文章
站长推荐
- ASP.NET 使用Swagger开发Web API接口项目
- asp.net-mvc – 我如何编写一个MVC3 / 4应用程序
- 强烈推荐的一个工具ReSharper
- asp.net – 在标题后添加Gridview行
- iis-7.5 – ASP.NET Web API仅在某些服务器上返回
- asp.net-mvc-4 – 如何将自定义linq查询传递给视
- 我应该把我的日志文件放在哪里用于asp.net应用程
- .net – 如何使单元测试可以使用HttpContext?
- asp.net-mvc – 在github中避免使用ASP.NET密码?
- asp.net-mvc – Asp.net Mvc:Ninject – IPrinc
热点阅读