Solved

Adding ScrptManager Class to page from HttpModule

Posted on 2008-10-11
4
450 Views
Last Modified: 2013-12-17
I am working on a CMS that has ScriptMangers in every master page.  We are currently simplifying the MasterPage code so that it is easy to create simple templates without much ASP.NET experience.  So we are adding most complex items to the page from HttpModules instead of listing them directally in masterpages.

What namespace contains ScriptManager, UpdatePanel, UpdateProgress, etc;... I can't find them in the code.

The code sample is a sample of my HttpModule where I want to create a script manager and add it to the page.  I can't find script manger.  What am I doing wrong?
using System;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;
 

namespace WebBusiness.WebContent.Modules

{

    public class ScriptManagerModule : IHttpModule

    {

        public void Init(HttpApplication context)

        {

            context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);

        }
 

        void context_PreRequestHandlerExecute(object sender, EventArgs e)

        {

            Page page = HttpContext.Current.CurrentHandler as Page;

            if (page != null)

            {

                page.PreInit += new EventHandler(page_PreInit);

            }

        }
 

        void page_PreInit(object sender, EventArgs e)

        {

            Page page = sender as Page;
 

            //

            // Create Instance of Script Manager

            // Add instance of Script Manger to Page Header to Page Form Tag

            //
 

            ScriptManager sc = new ScriptManager();

            page.Form.Controls.Add(sc);

        }
 

        public void Dispose()

        {

        }

    }

}

Open in new window

0
Comment
Question by:hoyaabanks
  • 2
4 Comments
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 500 total points
ID: 22694755
System.Web.UI Namespace

System.Web.UI.ScriptManager
System.Web.UI.UpdatePanel
0
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 22991778
the author asked for the namespaces required and i suggested them
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now