ASP.NET has for long been a popular web application development platform. ASP.NET 2.0 added a lot of new features compared to its earlier counterpart, i.e., ASP.NET 1.1. With ASP.NET 3.5, you have even more features. This article will present the new features that have been added to ASP.NET and Visual Studio 2008.
Fine, but, what’s new?
In ASP.NET 3.5, a new tool has been introduced called the ASP.NET Merge Tool. You can use this tool for merging pre-compiled assemblies. No, this is not all. There isa lot of other exciting features and we will explore each of them as we progress through this article. The most significant improvements in ASP.NET are:
- Integrated Ajax Support
- New Data Controls (ListView and DataPager)
- The LinqDataSource Control
Visual Studio 2008 has also included some features for an improved web application development experience. Here is the list of such improvements:
- Support for LINQ
- Improved Design time experience
We will explore each of these features as we progress through this article.
New ASP.NET Features
We will start our discussion with the improvements in ASP.NET. The sections that follow discuss the significant improvements made in ASP.NET 3.5. Integrated Ajax Support
- Reduction of unnecessary web server hits, i.e., the round trips are minimized
- Rich, responsive user interface
- Real-time web page updates
- Language neutrality
- Faster web page renderings
- Less consumption of server’s resources (memory and processor load is reduced)
Ajax was introduced in ASP.NET as a separate add-on called ASP.NET 2.0 AJAX Extensions. This extensions library enabled you to design and implement Ajax enabled web applications using ASP.NET. The ASP.NET 2.0 framework incorporates the client script libraries of the ASP.NET Ajax framework. “The framework includes two distinct yet not mutually exclusive API’s: client and server, which enable the developers to accomplish AJAX functionalities using direct client-side programming, traditional server-side programming, or any combination of both”.
And, you also have the ASP.NET AJAX Control Toolkit, a community project from Microsoft that comprises of a SDK and code samples. According to Microsoft, “The ASP.NET AJAX Control Toolkit provides a set of sample controls and extenders that makes it a snap to spice up your web site with rich functionality”.
In ASP.NET 3.5, you also have support for the ASP.NET server side application services like, Authentication, Membership, Roles Management, Profiles, etc, exposed as web services. You can call these services from client side scripts seamlessly. With ASP.NET 3.5, you have built in support for creating AJAX enabled web pages for ASP.NET. You can also create ASMX & WCF based web services and consume them using the Microsoft AJAX Library.
New Data Controls (ListView and DataPager)
ASP.NET 3.5 includes two new data controls, namely, ListView and DataPager. The new and improved ListView control included as part of ASP.NET 3.5 support all CRUD (Create, Read, Update, Delete) operations. It also supports paging and sorting of data. You can use the new DataPager control to implement paging functionality to your data controls seamlessly. You can find more information on how to use these data controls in my latest book titled, ASP.NET Data Presentation Controls Essentials (Packt Publishing). In my book, I have discussed how to bind data to these new data controls introduced in ASP.NET 3.5 using LINQ. The LinqDataSource Control
The LinqDataSource Control enables developers to declaratively bind data to ASP.NET data controls by executing LINQ queries against the data stores. The LINQDataSource Control can also be used to execute stored procedures and complex queries. It can be used to bind data to a wide variety of data sources like, custom business objects, collections or databases. Scott Guthrie says, “One of the benefits of using the <asp:linqdatasource> control is that it leverages the flexibility that LINQ based ORMs provide. You don’t need to define custom query/insert/update/delete methods for the data source to call – instead you can point the <asp:linqdatasource> control at your data model, identify what entity table you want it to work against, and then bind any ASP.NET UI control against the <asp:linqdatasource> and have them work with it.” Reference: http://weblogs.asp.net/scottgu/archive/2007/07/16/linq-to-sql-part-5-binding-ui-using-the-asp-linqdatasource-control.aspxLet’s Let’s dig into some code again. Here is how the LINQDataSource Control can be declared. <asp:LinqDataSource
</asp:LinqDataSource> And, here is the mark-up code of a GridView Control that illustrates how you can use the LINQDataSource Control shown above to bind data. <asp:GridView
<asp:BoundField DataField=”SalesCode” />
<asp:BoundField DataField=”SalesDate” />
<asp:BoundField DataField=”SalesQuantity” />
<asp:BoundField DataField=”SalesPrice” />
<asp:BoundField DataField=”SalesmanName” />
</asp:GridView> New Visual Studio 2008 Features
The most exciting thing that I observed in Visual Studio 2008 is that you can write your code that targets any one of the following versions of .NET Framework. Microsoft .NET 2.0
Microsoft .NET 3.0
Microsoft .NET 3.5 And, most importantly, Visual Studio will automatically filter the intellisense, the items in the Add Reference dialog box and the controls in the toolbox to show only the features that the version in use supports. Awesome! Isn’t it? No, this is not all. There are some other new and exciting features too. Read on. Support for Language Integrated Query (LINQ)
Language Integrated Query or LINQ comes with Microsoft .NET Framework 3.0 and extends the query syntax of C# and VB.NET to allow the developers to query data without having to write data store specific code. Let’s dig into some code, right? Here is a sample code snippet that illustrates how you can query data using LINQ. List<string> students = from s in StudentMaster
where s.StudentCode = 1011
select s.StudentName; According to MSDN, “Language-Integrated Query (LINQ) is a set of features in Visual Studio 2008 that extends powerful query capabilities to the language syntax of C# and Visual Basic. LINQ introduces standard, easily-learned patterns for querying and updating data, and the technology can be extended to support potentially any kind of data store.” Reference: http://msdn2.microsoft.com/en-us/library/bb397926.aspxImproved Improved Design time experience
ASP.NET 3.5 and Visual Studio 2008 promises to deliver improved flexibility and developer experience. Scott Michael says, “The new versions of Visual Studio and ASP.NET add some interesting and overdue features. With ASP.NET 3.5, Microsoft has moved the ASP.NET AJAX framework from a stand-alone extension to part of the .NET Framework, and has rounded out its data Web controls offerings with the addition of the ListView and DataPager controls.” Reference: http://aspnet.4guysfromrolla.com/articles/112107-1.aspxIn In this article we have had a look at some of the exciting features added to ASP.NET and Visual Studio 2008. We will learn more on each of these features in the forthcoming articles in this series. We will learn how we can make use of such features in our web application development. Happy reading!