Adding script with ScriptManager to CompositeControl?

I am trying to name my good old "RegisterClientScriptBlock" in a friendly ScriptManager class.

Is it just not working for my CompositeControl? I use it on a normal usercontrol (ascx) where it works.

Visual Studio simply won't accept me by typing "ScriptManager", or I get "The name" ScriptManager "does not exist in the current context" if I do that and try to compile. What's wrong - I have references to System.Web.UI and I even got a resharper to help me add it (and a using statement) - if it was only there.

Ok so something very simple and logical is going now, I just need to know that ...

Any ideas?

I got Visual Studio 2008 Service Pack 1 (SP1).

EDIT: The CompositeControl that doesn't work is actually a simple class library and not part of the web application. I know this can cause problems since I would need to link to the page in some way - I tried to look at the ClientScriptManager, but its constructor is internal, indicating that it is being used somewhere, like internally, from the ScriptManager , - but it also hints that there might be an input from a class library (without a reference to the page object)

+1


source to share


1 answer


ClientScriptManager cs = Page.ClientScript;
cs.RegisterClientScriptBlock(GetType(), "GenerateMatrixText", script, true);

      



Finally found this :)

+1


source







All Articles