Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Adding ScrptManager Class to page from HttpModule

Posted on 2008-10-11
4
Medium Priority
?
466 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

670 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