c# - Calling ScriptManager from a class -


i'm trying execute javascript function c# class in asp.net application. i'm using scriptmanager. have class updateui, contains following method:

public static void runscript() {     try     {         if (httpcontext.current != null)         {             page currentpage = httpcontext.current.handler system.web.ui.page;             scriptmanager.registerclientscriptblock(currentpage, currentpage.gettype(), "disablecontrols", "disablecontrols()", true);         }     }     catch (exception ex)     {     } } 

when call updateui.runscript() static class, httpcontent.current null. idea how should go in order able execute scriptmanager class not code-behind?

pass httpcontext method within static class. tim schmelter's comment indicates, calling httpcontext.current fail if it's not done in response incoming request.

public static void runscript(httpcontext context); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -