Calling Javascript from a Class Library

前端 未结 2 363
感动是毒
感动是毒 2021-01-22 11:31

I have created a class library DLL to be referenced from any third-party application and it contains only one function that calls a JavaScript to read a local file and returns s

相关标签:
2条回答
  • 2021-01-22 12:08

    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(...)
    
    0 讨论(0)
  • 2021-01-22 12:17

    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.

    0 讨论(0)
提交回复
热议问题