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)

0

1 Answer 1

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

Finally found it :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.