在用户空间中调用ClientScript.RegisterClientScriptBlock方法

ClientScript的命名空间是System.Web.UI.Page,并且要实例化之后的Page才能条用ClientScript。

用户自定义空间不是继承自Page,因此不能直接使用ClientScript这个类。如果要使用这个类,需要通过找到调用页面对象的方式。具体做法:

this.Parent.Page

找到这个对象之后,就可以像在普通页面中一样,自由调用System.Web.UI.Page命名空间下的类和方法了。

 

参考:用户控件页为什么找不到.ClientScript.RegisterClientScriptBlock原因 http://blog.csdn.net/sendling/archive/2008/07/11/2637287.aspx 本文来源于 龙卷风资讯网 http://www.ljf.cn/ ;原文地址:http://www.ljf.cn/2009/9/Item231232.html

相关文章:

  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
  • 2021-05-26
  • 2021-12-11
  • 2021-04-10
猜你喜欢
  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
相关资源
相似解决方案