Calling Javascript from a Class Library

ε祈祈猫儿з 提交于 2019-12-02 02:21:34

You can get the page instance from within the HttpContext like this:

Page page = (Page)(HttpContext.Current.Handler);
page.ClientScript.RegisterClientScriptBlock(...);

This is C# but should be easy to convert to VB.NET as well.

Edit: here is the VB syntax:

Dim page As Page = HttpContext.Current.Handler
page.ClientScript.RegisterClientScriptBlock(...)
anurag_it

You can add reference of System.Web.Extensions & System.Web.UI class to your class library and get the privilege of Working on ScriptManager. RegisterClientStartUp function which can be called in Update Panel too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!