C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

New features in ASP.NET 2.0


Posted Date: 20 Jul 2004    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: Sailesh Kumar SahaMember Level: Bronze    
Rating: 1 out of 5Points: 7



New Features in ASP.NET 2.0

Introduction

ASP.NET 2.0 introduces a lot of new features. Some of these features aim to simplify the problems faced using the earlier versions and some features are introduced to provide lots of new facilities.

ASP.NET 2.0 aims to reduce the amount of code required to accomplish common Web programming tasks by 70 percent or more.

The most important features that are to be incorporated in ASP.NET 2.0 are:

1. Master Pages

Master Pages is supposed to remove one of the most important deficiencies of earlier versions of ASP.NET. Normally till now whenever a developer wants to replicate a common functionality of a web-page in other pages (basically use it as a template), the most possible option he uses is creating a user control and then replicate the functionality in other pages. It is very cumbersome. ASP.NET 2.0 aims to solve this problem by introducing the concept of Master Pages. First the developer needs to define a Master Page containing content that he wants to appear on other pages and then use ContentPlaceHolder controls to define the locations where sub pages can plug in content of their own. Then he has to build sub pages—ASPX files—that reference the master using directives like this one:
<%@ Page MasterPageFile="~/Trial.master" %>

In the sub pages, the developer has to use Content controls to fill in the placeholders in the Master Page.

In addition, an application can designate a default Master Page in Web.config, as shown here:
<configuration>
<system.web>
<pages masterPageFile="~/Trial.master" />
</system.web>
</configuration>

2. Data Source Controls

Data binding is even easier in ASP.NET 2.0, often requiring no code at all. There are a lot of new data source controls like: SqlDataSource, XmlDataSource, AccessDataSource etc to make the data binding much simpler.

For example suppose we want to bind a Student details table to a data grid in ASP.NET 2.0, then we just have to write the following few lines of code to do the job for us:
<html>
<body>
<form runat="server">
<asp:SqlDataSource ID="Students" RunAt="server"
ConnectionString="server=localhost;database=school;
SelectCommand="select roll_no, first_name, last_name, age, class from students" />
<asp:DataGrid DataSourceID="Students" RunAt="server" />
</form>
</body>
</html>

The SqlDataSource control defines the data source and the query performed on it, and the DataGrid's DataSourceID property points to the SqlDataSource. When the page loads, the SqlDataSource control performs the query and feeds the results to the DataGrid.

3. Themes and Skins

ASP.NET 2.0 introduces the concept of Themes and Skins by means of which the look and feel of the web pages can be enhanced to a great extent to make them visually catchy and attractive.

A skin is a set of visual attributes applied to a control type. A theme is a collection of skins. There are a lot of predefined themes in ASP.NET 2.0 and one can find them in subdirectories underneath Microsoft.NET\Framework\...\ ASP.NETClientFiles\Themes.
One can use it by using the following line of code:
<%@ Page Theme="SmokeAndGlass" %>
(SmokeAndGlass is one of the pre-defined themes).

The @ Page directive's new Theme attribute declaratively applies a theme to a page. Themes can also be applied programmatically using the Page class's Theme property. One can define themes and skins of his own and privately deploy them in subdirectories stemming from an application's Themes directory. Each subdirectory constitutes a theme, and the theme name equals the subdirectory name.

4. New Controls

There are around 50 new controls defined in ASP.NET 2.0. These new controls can be classified into the following groups:
• Mobile Controls
Pager - Partitions pages for rendering to small devices
PhoneLinks - Dials phone numbers on phone-enabled devices
• Rich Controls
TreeView - Renders hierarchical data as expandable/collapsible trees
Wizard - Guides users through step-wise procedures
• Login Controls
Login - Interface for logging in with user names and passwords
CreateUserWizard - Interface for creating new accounts
• Simple Controls
BulletedList - Displays bulleted lists of items
FileUpload - Permits files to be uploaded through Web pages
• Data source Controls
AccessDataSource - For data binding to Microsoft Access databases
XMLDataSource - For data binding to XML documents

5. Personalization

Personalization provides a ready-built solution to the problem of storing personalization settings for users of one's site. Currently, such settings are typically stored in cookies, back-end databases, or a combination of the two. It’s cumbersome.

The ASP.NET 2.0 personalization service makes it easy to store per-user settings and retrieve them at will. It's based on user profiles, which you define in Web.config using the new <profile> element.

One can set the profile properties using the following piece of code:
<profile>
<properties>
<add name="UserName" Type="System.String" />
<add name="Password" Type="System.String" />
</properties>
</profile>

It defines 2 properties: UserName and Password. At run time, one can access these properties for the current user using the page's Profile property as follows:

String username = Profile.UserName;
String password = Profile.Password;

Similarly one can set back the profile properties as follows:

Profile.UserName = “xyz”;
Profile.Password = “abc”;

Summary

These are just few of the new features that we are going to see in the new version of ASP.NET. Hope in my next article, I will focus on the remaining features.




Responses

Author: Natarajan.M    26 Dec 2005Member Level: Gold   Points : 0
This is rellay easy to findout the difference quickly.Thnks a lot for showing this


Thanks & Regards,
Natarajan.M


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to maintain the session in sql server
Previous Resource: TabControl for ASP.Net
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use