Building a DataGrid Helper Control for ASP.NET 1.x: Part 2
page 5 of 5
by Li Chen
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 26162/ 50

Final Notes

[Download Code]

We have successfully realized the promise of code-free programming a complete data access page in ASP.NET 1.x. Now let us examine the limitation of our implementation and compare it to the proposed offering in ASP.NET 2.0.

  1. The current version of the DataGridHelper control uses the functionality of the DataGrid control to retrieve data key. Since the DataGrid control only supports single column primary key, the DataGridHelper control inherits the same limitation. The data source controls in ASP.NET 2.0 supports a multiple-column key. In order to support a multiple-column key, we have to build our own key storage and retrieval mechanism in the DataGridHelper control.
  2. Although the DataGridHelper can extract user input from bound columns, it still cannot extract user input from template columns; the users of the control need to extract the input with code in the BeforeUpdateData event. The ASP.NET 2.0 has a mechanism called two-way binding that makes it possible to update data with controls embedded in a template.
  3. Although we realized code-free programming by using the xxxDataAdapters and their wizards in ASP.NET 1.x, ASP.NET 2.0 also offers data source controls that can bind to object data sources. However, ASP.NET 2.0 requires a rigid mapping between the data columns and method parameters of the object. In contrast, the DataGridHelper control simply uses name/value pair to pass data.  We believe that our approach is very easy to understand and flexible.

In conclusion, we have developed a DataGridHelper control that can drastically simplify DataGrid programming. When used with data adapters, it is possible to develop a data access page with sorting, paging, updating and deleting capabilities without writing a single line of code.

For updates, please check For comments, questions and suggestions, please email

View Entire Article

User Comments

Title: Data Grid update   
Name: Rakesh Krishna
Date: 2008-08-20 3:18:10 AM
plss help me how to write the code to update linkbutton in grid
Title: how to select all rows of a datagrid   
Name: dhananjay
Date: 2007-05-15 8:20:06 AM
how to select all rows of a datagrid
Title: not bad   
Name: srinithy
Date: 2007-04-20 6:38:27 AM
such codings is not bad . if there are some outputs means it is very useful to the users.
Title: Ok Good   
Name: S.R.Vidhyasagargee
Date: 2007-03-31 6:32:11 AM
I need datagrid select,delete,update move next, delete
anybudy know this concept and I need Handling two grid shares information. Please e-mail me id
Title: useless   
Name: jjjjjjjjjjjjjjjj
Date: 2007-03-29 4:29:45 AM
this article was really useless
it does not carry any useful information
Title: DATE   
Date: 2007-03-26 4:20:26 AM
I was working on datagrid and this article made my work easy. Once again i am thanking the Author.
Title: Never seen before   
Name: govardhan
Date: 2007-01-05 12:19:08 AM
This article really helped me a lot,thanks for this team.
Title: datagrid in dot net   
Name: ramesh
Date: 2006-11-15 2:34:53 AM
I need datagrid select,delete,update move next, delete
anybudy know this concept mail me id
Title: Thanks   
Name: Arun ::.
Date: 2006-10-12 7:32:55 AM
I was working on datagrid and this article made my work easy. Once again i am thanking the Author.
Title: Easy to learn   
Name: Umapathi Naidu
Date: 2006-09-26 5:21:04 AM
I am very happy work with, If got ant new task related to,c#,

This site is very helpfull to me.

Title: how set multi line with cel in the data grid?   
Name: suresh
Date: 2006-07-29 2:13:54 AM
how set multi line with cel in the data grid?
Title: Wonderful   
Name: Sudhakar
Date: 2006-05-03 5:35:57 AM
this is really very useful artical to evevy one
Title: Delete message   
Name: Ramesh
Date: 2006-02-23 4:49:22 AM
Can you please send me the sample code for datagrid button column conformation messsage for deletion

Title: nice one   
Name: vishnu
Date: 2005-11-30 5:19:33 AM
very useful article. waiting for u r next article
Title: Thank you   
Name: Shyam
Date: 2005-10-31 5:10:10 AM
The article is very interesting and helpful. Thanks for the article
Title: Mr   
Name: Navid Iqbal
Date: 2005-06-03 11:50:52 AM
Data Grid Control is a very useful option is very great option in, i thank to you that u provided me the Code.
Title: it help me from my one hours mind exercies   
Name: rajat
Date: 2005-03-16 1:57:55 AM
thx for this
Title: Wicked   
Name: Hak
Date: 2005-03-11 6:40:28 AM
I loved it, it will more helpfull if we can't ask users to print before deleting. i guess will need a print option.

Any help on that?

Title: Update for VB   
Name: David
Date: 2005-03-08 3:58:57 PM
Is VB code needed for the edit and update command to work? I don't see the update and edit VB code in the downloaded example. I keep getting an 'expected parameter' error.

Any help would be great. I love the datagrid.

Title: Re: textbox size   
Name: Li Chen
Date: 2004-12-22 12:35:33 PM
Here is one of the ways to adjust the text box width:
1. Write an event handler for ItemCreated event of the Datagrid control. 2. If the ItemType is EditItem, use e.Item.Cells(TheColumnYouWantToAdjust).FindControl(0) method to get a reference to the textbox control. You can then set the width.
Title: textbox size   
Name: pandaz
Date: 2004-12-22 3:59:04 AM
its a very useful article, but how do i adjust the size of the textbox after pressing the edit button?
Title: Test   
Name: Mayur
Date: 2004-12-21 6:56:59 AM
Realy Nice thankx
Title: Very useful. But if I need PK with 2 columns ?   
Name: jkancio
Date: 2004-09-21 1:01:18 PM
Congratulation ! very interesting control and tutorial.
You said: "In order to support a multiple-column key, we have to build our own key storage and retrieval mechanism...". Do you have some example showing how to do it ???
Title: DataGridHelper   
Name: Prem Kannan
Date: 2004-08-21 3:13:11 AM

I've gone through your DataGrid Control Helper. That was nice.

I need one help from you. How can I update the currently edited record automatically. I don't want to show UPDATE button. As and when he leaves the last column of the current record, system should automatically update the record.
Title: Title   
Name: Test
Date: 2004-08-17 11:52:30 AM
Thank you for this. It is very helpful.
Title: Nice one   
Name: Pathik
Date: 2004-08-17 5:00:03 AM
Really nice one!
Title: thank you!   
Name: John Braga
Date: 2004-08-17 3:58:49 AM
Thank you for an interesting set of articles. I shall certainly be trying it out.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2023  |  Page Processed at 2023-10-04 12:18:13 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search