Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Group info
Members: 21
Language: English
Group categories:
Computers > Databases
Computers > Programming
Computers
More group info »
Recent pages and files
using-the-datagrid-itemdatabound-event    

?

The DataGrid is of course probably themost popular and most implemented GUI control in ASP.NET 1.x. One ofthe fun parts of working with this control is the level of flexibilityit brings developers allowing for unlimited combinations of creativeimplementations.

By applying different design patterns to thebuilt-in functionality you can develop truly unique, robust, userfriendly interfaces that allow your users to quickly and easily locateand manipulate the information in the application.

As you workwith such a large scale component such as the DataGrid you will learnmore and more about the capabilities over time. As your knowledgeincreases so does the complexity of your WebForms. Before long theamount of code in your code-behind files starts to exceed even yourbusiness tier or database tier logic.

Learning developmentpattern tricks to help manage the amount of code you develop isimportant in application maintenance. How many times have you come backto a WebForm a few months after you developed it and had to read thecode for 30 minutes before you remembered what you did? This is acommon occurrence in a lot of applications that don't employdevelopment standard patterns. Or worse yet, if you did not author thecode yourself it can take you hours of research to unearth theprocesses behind other developers` code.

The purpose of thistutorial is 2-fold. First, we will look at a simple yet extremelyhelpful development pattern to help manage the columns in a DataGridcontrol. And second, we will look at how to implement correctly theItemDataBound event of the DataGrid control to implement some advanceduser interface display elements.

Note: VisualStudio .NET 2002/2003 running ASP.NET 1.x is required for thistutorial. Both VB.NET and C# code samples will be provided

Setting up

Firstwe will need a sample ASP.NET project to work with. You can use eitherVB.NET or C# as your code type. Begin by starting up Visual Studio .NETand creating a new ASP.NET web project named "ItemDataBound" for VB.NETor "ItemDataBoundCs" for C#. The reason for the different names is onlyfor compatibility with the sample code provided since I have bothversions running on my machine and can't use the same name.

Wewill work with the default WebForm1.aspx that is created with theproject. Double click this file in the solution explorer and flip theview into HTML view by clicking the HTML button on the lower left. Nowwe need a DataGrid control to work with. We will manually add thiscontrol to the WebForm1.aspx WebForm using HTML.

Before we addthe control let's review what we are trying to accomplish first. Wewill use our DataGrid control to display a list of cars. Imagine afictitious car sales company using this DataGrid component to viewtheir inventory of automobiles.

Read More
Version: 
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google