Introduction
ASP.NET 2.0 proposes to increase developer productivity by 70% with much less code and wide variants of supporting tools. ASP.NET 2.0 framework comes with member ship and role management to store and validate user credentials. It provides support for personalization process through which a user is identified and a profile is loaded or managed. On the User interface side ASP.NET 2.0 provides master pages for maximum UI inheritance, site navigation providing structured links, themes for UI skinning, web part framework for portal style applications and 45 new server controls.
Master Pages
Master page implementation basically revolves around 3 basic elements.
New ASP.NET 2.0 Controls
- Data source controls enables us to declaratively access data from web forms. They are available inside the System.Web.UI.WebControls namespace.
- <asp:SqlDataSource> - Sql data source is designed for relational databases particularly Microsoft SQL server databases.
<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="Data Source=.;Initial Catalog=Employee;User ID=sa"
SelectCommand="SELECT [FirstName], [LastName], [JoinDate],
[UserDesignation] FROM [employee]"
InsertCommand=""
DeleteCommand=""
UpdateCommand="">
<SelectParameters></SelectParameters>
<DeleteParameters></DeleteParameters>
<FilterParameters></FilterParameters>
<InsertParameters></InsertParameters>
<UpdateParameters></UpdateParameters>
</asp:SqlDataSource>
Developers can now connect to a new database by simply changing the connection string in the page itself.
- <asp:ObjectDataSource> - Object data source is designed to deal with objects in N-tier based applications. They treat our business objects as a source of data.
- <asp:AccessDataSource> - Access data source control is derived from the SQL data source control but designed to work with Data files. They expose a property called DataFile which points to an Access MDB file. It is not recommended to use Access data source in a production environment.
- <asp:XmlDataSource> - It supports binding to XML files through DataFile property. We can also specify the associated XSLT through TransformFile property. Xml Data source is mostly used when we need a hierarchical representation of data to be used with controls like TreeView or ListView.
- <asp:SiteMapDataSource> - Provides support for web sitemap navigation. This is yet again a hierarchical XML structure. Sitemap data source is bind to treeview or Menu control.
- Data-bound controls – Displays data
- <asp:GridView> - It is the successor of data grid. New functionalities like sorting, paging, editing and deleting are now part of it. Earlier we need to write custom code within the DataGrid to handle all this.
- <asp:DetailsView> - To display a specific record in a master / details scenario. It functions almost like the Microsoft access forms through which we can add record by record. This is possible only if the underlying data source supports updating.
- <asp:FormView> - Display and modify the data stored in a DB. FormView require a user defined template for rendering, were as details view defaults to tabular rendering.
- <asp:TreeView> - Display data in a hierarchical view.
- <asp:Menu> - A hierarchical menu driven by a backend database.
- Security controls – Make it easier to implement authentication features.
- <asp:Login> - This control provides user authentication capability for form based applications
- <asp:LoginName> - Displays the name of logged in user.
- <asp:LoginStatus> - Display the status whether the user is logged in or not.
- <asp:PasswordRecovery> - Provides functionalities for lost password retrieval, which includes password resetting and password mailing.
Themes
Themes enable us to define visual styles for web pages. The concept is very much similar to CSS. Themes provided extended capability for providing styling for server controls. Default themes are stored under App_Themes directory. They come with the extension .skin.
ASP.NET 2.0 comes with another visual styling tool called skins. They basically define properties and templates that can be applied to controls and they are more or less control specific.
Themes can be easily conceptualized as set of skins.
Themes fall under two categories
- Customization themes - In this case, properties of the theme will override the control property.
- Style sheet themes - Here control property override the theme property.
Visual Studio 2005 improvements
I would like to point out few of the noticeable improvements made to VS 2005
- Better source code editing with full intellisense support at different levels [ script, page directives, inline css, web.config ]
- HTML source preservation
- Tag Navigator
- Code refactoring
- Smart tasks which pop up the list of common tasks
Type of Web Projects Available Under VS 2005
- File system – Enables us to host our website into any folder. This does not require IIS or FrontPage extensions. Visual studio makes use of it’s built in web server to support the project.
- Local IIS Support – Host your website with in the IIS ( As in VS 2003 )
- FTP support – Enables to deploy web applications onto a remote web server.
ASP.NET 2.0 is supported by the capability to request a web form without a single compilation, called Pre-Compilation. We have two types of pre-compilations.
- In-place precompilation, in which all ASP.NET files are compiled and placed in a folder.
- Deployment, this is to support xcopy & FTP in ordinary deployment scenarios. No source code is deployed to the server. Even the content of .aspx files are removed.