Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / ASP.NET

PageManager control for ASP.NET

4.50/5 (10 votes)
27 Oct 2010CPOL2 min read 50K   635  
PageManager is a web server control which allows developers to easily integrate jQuery and JavaScript files.

Introduction

PageManager is a web server control which allows developers to easily integrate jQuery and JavaScript files in ASP.NET Web applications.

PageManager control is included in the Extensible Web Toolkit (XWT). Please download the Toolkit in order to use PageManager control:

The key features of the PageManager control are:

  • jQuery support PageManager control includes the latest jQuery file.
  • jQuery CDN supportPageManager control includes the latest CDN URL.
  • Custom JavaScript files inclusion – You can include your own JavaScript files in PageManager control.
  • Web.config file support – All the PageManager control’s functionality can be easily implement through web.config file.

Example - jQuery Support

Latest jQuery library (1.4.2) is integrated into the PageManager control.

Drag and drop PageManager control into an ASP.NET page and start writing jQuery code.

Write a simple jQuery function and view in the browser:

Example – jQuery CDN Support

You can use CDN for jQuery by simply setting the EnableCDN property to true. This can be done for a specific ASP.NET page or for the entire application using the web.config file. You can also change the CDN URL by using setting the CDNUrl property. CDN support is disabled by default however.

Example – Custom JavaScript Files Inclusion

You can include any JavaScript file using Scripts property. This can be done for the entire application through web.config file as well.

You can also enable/disable a particular script file using Enable property.

Example - Using web.config File to Setup PageManager for the Entire Application

All the following functionalities can be done using web.config file. However, these settings can be overridden by the ASP.NET page's PageManager settings.

  • Add a different jQuery file
  • Enable/Disable jQuery file
  • Enable/Disable jQuery CDN
  • Set jQuery CDN URL
  • Add JavaScript files
  • Enable/Disable individual JavaScript file

Settings in customScripts section:

  • enable - Enable/disable all the script files
  • CDNUrl – URL for the CDN location
  • EnableCDN - Enable/disable CDN
  • JQueryFile - jQuery file to be used

Settings in scripts section:

  • id - File Id
  • path - Path for the script file
  • enable - Enable/disable script file include

In order to use PageManager control in web.config, you must first add the configuration section as shown in the following screen capture:

You can also add JavaScript files for the entire application using scripts section as shown in the following screen capture:

Conclusion

PageManager control can be useful when you write script intensive web applications. It includes latest jQuery file and JavaScripts can be managed by the web.config. There are many more other useful and lightweight controls in XWT. You can download the complete XWT toolkit from here.

Read more on Extensible Web Toolkit:

Update

Please read the following article on MessageControl--another XWT control which lets you display user messages like in Gmail application:

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)