I assume that you do not know how to reference the ScriptManager in a class library, where these WebControls not usually referenced. In addition, I think you also need to know how to get the link to the page in a static context from the class library.
To get the ScriptManager , you must add a link to System.Web.Extensions to the class library project.
To get a link to a page in a static context, you need to add the System.Web , and then returns the ScriptManager current page:
FROM#:
var http = System.Web.HttpContext.Current; if ((http != null)) { var page = http.CurrentHandler as Web.UI.Page; if (page != null) { var scriptManager = System.Web.UI.ScriptManager.GetCurrent(page); } }
VB.NET:
Dim http = Web.HttpContext.Current If Not http Is Nothing Then Dim page = TryCast(http.CurrentHandler, Web.UI.Page) If Not page Is Nothing Then Dim scriptManager = System.Web.UI.ScriptManager.GetCurrent(page) End If End If
source share