A blog of ASP.NET 2.0 Samples, Articles, Reviews and Discussions. The purpose of this blog is to provide a resource to the quick information that developers need on Microsoft's new ASP.NET 2.0.

Tuesday, November 29, 2005

ASP.NET 2.0 Master Pages

Master Pages are good way to create controlled templates for sites. I use them personally to create a couple forced interfaces and thus organize all of our interfaces in a couple of files. Good things is that if you wanted to change something, you would only have to change one file to affect the whole site. With this new plan of attack, designers and developers can now work together to make a common interface without stepping on each other toes.

Link: http://url123.com/n9xu8

Custom Providers ASP.NET 2.0

There comes a time when you need your own provider. I needed to build one just so that our application could access SQL Server and not just rely on my changes in machine.config. I do recommend finding your machine.config
[Windows\Microsoft.NET\Framework\Version\Configs ] and looking at the default samples at the bottom of the file. This helped me really write my own provider. The link below overviews the provider model and its good practices.

Link: http://url123.com/nr6bc

N-Tier Applications and Table Adapter

I have been searching for a solid link to a full explaination of N-tier applications on .NET 2.0 . I came across a nice article that not only reviews this topic but the Table Adapter also. You can add a dataSet and then use the Table Adapter as a level of abstraction. The Table Adapter allows for multiple queries to be run against it not to mention for the defining of your own methods. There is also a wizard that makes the process of creating a TA easy as possible.

Link: http://url123.com/nrvbd

New DataSet Features

The dataSet is now not the only core piece of in memory representation of Data. The table adapter is a nice control that has been added. More on this later... For now, if you wish to stil perform DataSet operations or use the new features; this article is for you.

Link: http://url123.com/nr3b3

Transactions in ASP.NET 2.0

Transactions have been improved with now the ability to not only run transactions from the code for DBs but run transactions for common tasks. Say you are updating a couple files and things could mess up. Use a transaction. Say you have a long bulk process that must all happen at once or not at all. Use a transaction.

Link: http://url123.com/nrcby

ASP.NET 2.0 Login Controls

ASP.NET 2.0 again tries to make our lives easier by providing login controls. These controls are pretty straight forward and save loads of developer time instead of thinking of work arounds. Linking login controls to an underlying dataSource and handling authentication is now a simple process.

Link: http://url123.com/nsngx
Link: Login without Login Control

ASP.NET 2.0 Asynchronous Callbacks

Microsoft has made it easier than ever to implement Ajax with controls. Developers can now implement Ajax interfaces with any control using little code. Dont forget to register your event as a client-side callback [ control or page must implemnt ICallbackEventHandler] or check to see if a browser is allowed to use client-side postbacks [SupportsClientCallbacks property]. The links below give a good overview of the technology and .NET 2.0 out-of-the-box support. Also be sure to add the required fucntion to test if there is an error:


function ClientCallbackError(result, context){

Link: http://url123.com/nsxga
Link: http://url123.com/md47u
Link: http://url123.com/nsagz

DropDownList with GridView

Using a DropDownList to trigger a load in a GridView is such a great feature its a shame I had to go to a beta version book to find it.

Goal: 1 DropDownList of States filtering 1 GridView of Customers

1.) Add a DataSource control to handle data ( I chose SQL Server ):

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
="<%$ ConnectionStrings:CustomersConnectionString %>"
="SELECT DISTINC State FROM [Customers] ORDERBY State"
="True" CacheDuration="300" />

Note : The connection string is from my web.config
Note : Cache because the data doesnt usually change [Just a group of States]

2.) Add a DropDownList control let's say full of States:

<asp:dropdownlist id="statesDDL" DataSourceID="SqlDataSource1"
DataTextField="State" AutoPostBack="True" runat="server" />

Note: AutoPostBack="True" to trigger the post back on change

3.) Add a Second DataSource Control with cool attributes:

<asp:sqldatasource id="SqlDataSource2"  connectionstring="<%$
"ConnectionStrings:CustomersConnectionString %
SelectCommand="SELECT CustName,CustAddress,CustCity,CustPhone FROM [Customers]

WHERE State=@State">

<asp:ControlParameter Name="State" ControlID="statesDDL" PropertyName="SelectedValue" />


4.) Add a GridView which will have data filtered by State:

<asp:GridView id="grid1" DataSourceID="SqlDataSource2" runat="server" />

( Dont ya just love the gridView code. )

CSS Table Designs

Below is a link I was given by Rahul Singh providing more than 60 CSS designs for tables. If youre short for a good design, this is a great place to download some good table styles. Don't submit to just using boring table and site designs. Make crisp GUI for a rich user experience.

Link: http://url123.com/nbbhu

ASP.NET SQL Registration

ASPNET_REGSQL.EXE is a great new application tool that comes with asp.net 2.0. It is located in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ and allows for such things as SQL Invalidation, the ASPNETDB installs, and for using SQL Server to store state information. I found the official article that details every little option. I personally prefer using the nice little wizard instead of the command prompt. You can easily just point to a db and install a user system in 5 minutes.

Link: http://url123.com/nbmhs

Get all Selected Items in ListBox Control

Seeing all the items that a user selects in a control is a common practice. Its kinda funny that this is not just simply explained all over the internet. I got the official link that shows the object structure and the property of the list box control SelectedItems. SelectedItems is a collection of everything selected which you can iterate through and perform manipulations.

Link: http://url123.com/nu7hp

ASP.NET 2.0 FormView Control

The formView control is an alternative to the DetailsView control as it allows you to define a template of how to place items on a web form. This is useful if you want to create nice interfaces with single records back from a DB. No more placing controls and them wiring them up.

Link: http://url123.com/n468c

HyperLink Column in Grid View

I keep seeing questions on how to push a hyper link column in a gridView and have it push details to another page. This is common when you are trying to add a view details page or do some other kind of processing [ when not using the detailsView control]. I have provided some links that give sample code of implementation.

Link: http://url123.com/neb8u
Link: http://url123.com/ne88v

.NET Generics

Generics are a good way to add type safety at runtime without the cost of overhead. A developer can really see the power when using collections. It is a good way to enforce type safety amoung your collections. I have collected a few articles on this topic that can get you up to speed on Generics.

Link: http://url123.com/nyarz
Link: http://url123.com/nynrx
Link: http://url123.com/ny78p

XML Integration in SQL Server 2005

XML is now a data type in SQL Server which adds a lot of functionality for storage and manipulation of XML. Now developers can type a field as XML and use methods and calls to easily produce solid XML code. I have collected a couple of links in overview of this topic. I also have provided a link that shows how to pass in XML as a parameter into SQL Server 2005.

Link: http://url123.com/nw8rk
Link: http://url123.com/nacrr
XML as param: http://url123.com/navrg
Illegal Chars in XML: http://url123.com/na6rn

SQL Server 2005 Cache features

I have found a good article that outlines a quick explaination on how to get working with SQL Caching. It teaches you the new Invalidation features as well as how to use the old output cache technique in 2.0. This is an absolute must if you plan on making enterprise level application.

Link: http://url123.com/cw593

Using Data Sources and Connection Strings

I have collected a couple links for common data access and for using connection strings. One of my favorite articles I have listed is the ability to encrypt your connecting string. This is handy if your application gets hacked and you do not want to have the attacker gain access to the database as well. It is also a good way of allowing multiple data access but not allowing them to see the connection

Data Access : http://url123.com/n3k9e
Encryption : http://url123.com/nwm9w

Web Services Overview [ 2.0] and WSE 3.0

Get started on the new 1.2 SOAP protocol and what web services have to offer in .NET 2.0. Developers will immediatly see the power they can achieve from connecting their applications. Longhorn [Vista] will rely on web services to do some of its great features. Dont ya want to know how they work :)

.NET 2.0 WS : http://url123.com/n3a9h
WSE 3.0 : http://url123.com/n3n9b

SQL Server Management Studio

SQL Server Management Studio is an excellent tool for doing any modifications of SQL Server. It is easy to script any process and the developer can fill a sense of comfort that if anything goes wrong it can be easily fixed. They even have an express [FREE] edition of it.

Free version: http://url123.com/nz6qc
Link to refrence: http://url123.com/nz99q
Link to refrence: http://url123.com/n3x98

ASP.NET Registration

ASPNETREGIIS is a good tool to know as a .NET developer. It is usually the first tool I turn to if I have a .NET scripts issue or I need to update to a new version [ forcing all my new apps to be 2.0 instead of 1.1]. This article gives a good overview.

Link: http://url123.com/nzvqd

Web Services Overview [ 1.1]

This is a 1.1 overview of web services. I will be soon posting an ASP.NET 2.0 version of web services and the enhancements made to the new framework. Web services are always a high subject of debate and using them in the wrong ways could prove costly.

Link: http://url123.com/nmbqu
Link: http://url123.com/nmeq6

XML Schema w/ DataSets

Schema is a good mid to advanced topic that every developer should master. Its better to build controls[ or xml ] against a good schema to make a solid foundation. I have found a good article that explains Schemas and their benifits for data sets.

Link: http://url123.com/ndkq9


Sometimes you need to have an assembly to be global to all applications. This is good when you have many developers working that need access to assemblies across the board. This blog entry reviews the changes in ASP.net 2.0 and has links to more in depth detail.


Monday, November 28, 2005

ASP.NET 2.0 Tree View

The popular treeView control is a high subject of interest so I wanted to add a good article to it. Its now easier than ever to add nodes and represent data in a hierarchy. Third party companies have even made decent drag and drop from treeViews to other controls such as data grids.

Link: http://url123.com/5hsdp

ASP.NET 2.0 Localization

The following link provides a quick tutorial on how to set your site up for the international community or another language outside of your own. Why just limit your app to only the people who speak your language? It explains how to let the client send you their prefered language and have ASP.NET 2.0 do the work for you. I have provided a couple samples that use both local [ on a page] and global [ across an application] localization methods. Its as simple as adding meta tags to resource files :).

Link: http://url123.com/2wrhp
Link: http://url123.com/2aczv

Accessibility Improvements in ASP.NET 2.0

Accessibility is a major issue if you plan to make applications for the government. Asp.net 2.0 provides new interesting models and this article is presented in two parts that give a good overview. I recommend this article to anyone who plans on web apps with sensitive data or wish to work in a secret cleared job.

Link: http://url123.com/vqhuc

Good Link on SQL Server 2005 Notification Services

Notification Services provide a model for watching for certian events within SQL Server and notifying clients who incline to receive events. Multiple pipes can be used such as email.

Link: http://url123.com/ybszn

SQL Server 2005 top 10 Features

An excellent overview of the top 10 Features in SQL Sever 2005

Subjects Covered :

1. T-SQL (Transaction SQL) enhancements
2. CLR (Common Language Runtime)
3. Service Broker
4. Data encryption
5. SMTP mail
6. HTTP endpoints
7. Multiple Active Result Sets (MARS)
8. Dedicated administrator connection
9. SQL Server Integration Services (SSIS)
10. Database mirroring

Link: http://url123.com/ybdzr

ASP.NET 2.0 Validation

Here are some links that provide an overview of the changes in validation with ASP.NET 2.0. This can come in handy as it is now easier to use validation as a vital piece to your code instead of an add later. I personally like the new API's to call validation from the code behind.

Link: http://url123.com/yuh32

Sunday, November 27, 2005

User Profiles / User Security

I keep seeing questions on [ asp.net forums]User profiles in ASP.NET 2.0 / SQL Sever 2005 so I decided to post some good links on it. There is no reason why you would never have a need for this. Every web app tends to need a user system even if its just for security for 1. ASP.NET 2.0 provides a robust User model that installs by using the aspnet_regssql.exe program [ shipped with asp.net 2.0 ]. You can easily add a full user/profile/personalization system in minutes.

Link: http://url123.com/ynr35
Link: http://url123.com/yu23e
Link: http://url123.com/yu53m
Link: http://url123.com/yvqwv
Link: http://url123.com/nukh9

Middle Tier : Object Data Source

The object data source control has been created to allow for the creation of a middle tier. You can use an object model for fetching and updating data not to mention provide a custom method of data access. A good example of how this is useful is that developers can just provide objects with methods that conceal the details of how data is actually fetched. Other developers can then just call methods to retrieve data.

Link: http://url123.com/yng3b

Cross Page Post Back

ASP.NET 2.0 supports an easier method for transfering objects between pages. All you have to do is set the url you wish for the information to post to and voila. You have access to everything on the last page and then create functionality on the second page.

Link: http://url123.com/yn43h

Themes and Skins

Site customization has always been an issue. Application developers now have a handy way to customize individual controls, pages, or the whole site at once. ASP.NET 2.0 does this through themes that contain skins. You can apply a skin to a control just by setting a property. The link below gives a good overview.

Link: http://url123.com/y5p3q

Good AJAX Links

Ajax is strongly emerging as the dominate way of creating a seamless user experience on the web. I believe Ajax will be the change of the internet and the way we interact with it. Its about time that we have a technology, as internet developers, that allows for an OS like GUI. Ive provided some links to get you caught up to speed and take advantage of ASP.NET 2.0 call back features.

Link: http://url123.com/y5yw3
Link: http://url123.com/y5uwd
Link: http://url123.com/y5swc
Link: http://url123.com/5r4xm

My IDE Environment

I like to create a solid work environment. Now that Microsoft has released a new suite of tools, I actually feel I can rely on my environment.


I like to use Windows 2003 Server Standard Edt. as my development platform. It provides a good secure front for your computer in general and also works with games I might add. You have more control on advanced issues and to test out the heavy hitters of Microsoft usually require this OS.


I chose Visual Studio 2005 Professional as my IDE as I am a Developer/Consultant. It provides you everything you need with nice wizard interfaces for common tasks. The intellisense has been reworked to allow for html assisted intellisense. The load time for most common tasks are fun and friendly. Being trapped in the microsoft experience for so long, the user can assume an option and VS.NET 2005 seems to have a way to do it. HTML editing is more sophisticated and easier to manipulate. If youre like me, you hate having to deal with html and would rather program the back-end. However, when you do have to manipulate it for scripting or looks; VS 2005 makes it easy.

Data Store

I chose SQL Sever 2005 Developer edition as my data store as it allows for a close to enterprise edition database framework. SQL Sever Management Studio is also included. Installation is simple and seamless.

Source Control

Visual Source Safe 2005 gets rid of the common problems VSS 6 had and provides an easy to setup secure method of storing Source. You may choose between the old way of storing source [1 person locking] or have the new merge style.

There is a new Grid in town!

This is a good resource for the gridView including information on creating data source controls. ASP.NET 2.0 provides data souce controls which handle all the encapsilated details of getting data. You may assign CRUD stored procedures or use specific queries. After your data source control is setup, you can point any control's data source property and have access to your data. This presents a loosly coupled way of data access.

Link : http://url123.com/ywpyq
Link : http://url123.com/nz3q3

Get started with .NET 2.0

This is a quick start to get going on developing .NET 2.0 applications.

First, Go visit : http://url123.com/ywdey

Here you can download the Free IDE Visual Studio 2005 Express. After you download the small Microsoft Downloader, you will notice you can also download SQL Sever 2005 Express edition. Its about 250 mb with SQL Server Express adding 50 more mb. I recommend getting both as SQL Express is a good free lightweight version of SQL Server 2005 and is adequate enough for developing purposes.

Note: The ASP.NET 2.0 framework will also be installed.

Second, Install Tools

Run the install on the new tools. The interface has been cleaned up and makes it easier to deploy your work environment. You no longer need a windows component CD, frontpage extensions or even IIS install [ eventhough I recommend it be Installed beforehand] .

Third, Visit http://url123.com/ywye3

The ASP.NET tutorials on the official website serve as a good quick start. Review articles on state management, data controls and access, compilation models.

Fourth, Review New Features by visiting :

Watch the ASP.NET Web Casts

Catch up on the new features of asp.net 2.0!!