views:

1408

answers:

1

I'm trying to call my good old 'RegisterClientScriptBlock' on the friendly 'ScriptManager' class.

It just doesn't work for my CompositeControl? I use it on a normal usercontrol (ascx) where it works.

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

Ok so something very simple and logic is going down now, i just need to know what...

Any ideas?

I got Visual Studio 2008 with SP1.

EDIT: The CompositeControl that doesn't work is actually a simple Class Library and not part of the web application the ascx file naturally is. I know this could cause problems since i would have to set a reference to the Page somehow - i tried looking at ClientScriptManager but it's constructor is internal indicating it's used somewhere like internally from ScriptManager - but it also hints that there might be an entrance comming from a class library (with no compiletime reference to the Page object)

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

Finally found it :)

Per Hornshøj-Schierbeck