Powerpacked new controls in Microsoft ASP.NET 3.5
By Vishal Khanna
The ASP.NET 3.5 framework is packed with a stream of new controls. Its an extension to the existing set of controls that comes with the ASP.NET 2.0 framework. This simply means that if you are working on Visual Studio 2005 and .NET 2.0, simply download the ASP.NET 3.5 framework from the Microsoft website. Ofcourse, you will need minor changes in the site settings in IIS during site deployment, by changing the version of .NET. In case you are using Visual Studio 2008, this already comes along with the .NET 3.5 framework, so you need not worry about the extra effort of downloading .NET 3.5.
In case you have downloaded and worked with the Microsoft ASP.NET Ajax library, you must be familiar with a few controls I am explaining below, like the ScriptManager, UpdatePanel, UpdateProgress, ScriptManagerProxy.
Note that while working with Visual Studio 2008, the web.config is always added by default, while creating a new web application, unlike what we witness with Visual Studio 2005.
Described below, details of the new controls:
DataPager - Controls like Gridview, Repeater exhibit the pagination behaviour. This is useful when display results return far too many records than an ideal web page height. A search may return countless records, but the web page size should not ideally go on and on depending on the number of records returned. For this, the feature of Page Numbers, OR Previous-Next feature at the bottom of the display results seem to be more ideal. For this purpose, the DataPager control has been introduced.
While using a ListView control, a DataPager control may be used along with it, to provide a paging functionality. The DataPager has a property called PagerControlId which is set to the ID of the ListView control. Simple!
ListView - This control is like an advanced Repeater control, and is as good as a GridView control in terms of features it has. It may be set to any standard data source like SQL, Oracle, Access, XML and even LINQ.
Say you want to display a matrix of values with 3 records per row, the ListView control is the ideal solution. The ListView settings may be made manually using the aspx page, OR may also be set using the Smart Tag feature to launch the properties dialog box.
ScriptManager - Every Ajax enabled page in ASP.NET that makes use of the Ajax Library needs to have a boss or a manager that takes care of the internal Ajaxification process. All this is controlled by the ScriptManager control. Every page should have not more than one ScriptManager control. It takes care of the javascript functionalities, partial postbacks made by the web page by taking care of the XmlHttpRequest object from behind the scenes. More on Ajax, Read Here.
If the EnablePartialPostback property of the ScriptManager is set to false, the web page exhibits a full page postback.
ScriptManagerProxy - There might be a scenario where your master page and content page need to have separate ScriptManager controls. For such situations, the ScriptManagerProxy control comes to rescue. Here, the masterpage may contain the ScriptManager control, and the content page may use the ScriptManagerProxy control. However, internally, the ScripManagerProxy control communicates with the corresponding ScriptManager class of the web page. The ScriptManagerProxy control actually transfers its set of responsibilities to the ScriptManager control.
UpdatePanel - This is the control that wraps all the controls that need to be partially posted back. A web page may comprise of several UpdatePanels. In case there is any event happening within the controls wrapped inside an UpdatePanel control, the entire page isn't posted back, rather only the contents within the UpdatePanel are posted back to the web server. If the partial postback property is to be avoided, set the ChildrenAsTriggers property of the UpdatePanel to false.
Further, the Triggers of an UpdatePanel may be used to set the application in such a way that the partial postback of the UpdatePanel may be invoked from controls that lie outside the UpdatePanel.
UpdateProgress - There are scenarios where a request may take time, an image may take time to load, a business logic may time to calculate, data may take time to load due to diversities in the source. In UpdatePanels, as postbacks are partial in nature, the browser's default progress bar does not appear. For avoiding any confusion to the end user, that a page process is going on in the background, the UpdateProgress control may be used. This is like a progress bar that shows to the end user that a process is going on. The progress may be set to any moving gif image as well, to enhance the look & feel of the web application.
Happy Reading.
Cheers!