Master Pages and ASP.NET AJAX (C#)
In this lesson, you will learn how to include AJAX functionality in an entire web application using a master page. Only a ScriptManager control is needed on the master page and a ScriptManagerProxy control on the content page for the specific AJAX functionality.
We'll cover the following
Importance of AJAX
Over the past several years, more and more developers have been building AJAX-enabled web applications. An AJAX-enabled website uses a number of related web technologies to offer a more responsive user experience.
Creating AJAX-enabled
How to include AJAX
It is imperative to add one ScriptManager
control to each and every page that uses the AJAX framework. The ScriptManager
control manages the client-side script used in AJAX-enabled web pages.
The HTML instructs the browser to download the JavaScript files that make up the
The above requirement changes if you add a master page to the website. Then a ScriptManager
control is added to only the master page.
Many of the larger
These days, ScriptManager
Control on the page. For a particular design, place the single ScriptManager
Control for the whole web application on the master page. This will make the page AJAX-enabled.
You can use this technique if your master page includes any AJAX capabilities, even if the content page makes no use of AJAX at all. This is also beneficial if you have JavaScript items to place on all pages of the web application.
If your content page also needs to make use of AJAX capabilities, you cannot simply add another ScriptManager
control to the page. Instead, the content page needs to make use of the ScriptManager
control already placed on the master page.
AJAX for content pages
If the content page needs specific functionality, it can access the controls on the master page using the ScriptManagerProxy
server control. This ScriptManagerProxy
control works exactly like this main ScriptManager
control, except that it is meant for content pages making use of a master page. The ScriptManagerProxy
control then interacts with the master page’s ScriptManager
control to perform any necessary actions.
Get hands-on with 1400+ tech skills courses.