Click here to Skip to main content
11,503,750 members (60,379 online)
Click here to Skip to main content

Fully functional Nested DataGrid

, 13 Mar 2006 101.7K 3.4K 60
Rate this:
Please Sign up or sign in to vote.
This application will help you to build a datagrid within a datagrid with all options like Edit, Delete and Add functionality.

Introduction

 This article will explains all the functionality of a Nested Datagrid. There are following funtionalities in the applcation :

1) Add / Edit / Delete functions for parent and child datagrids.

2) Tree view for parent datagrid.

3) validation for adding data.

Sample screenshot

Objective :

  Most of the datagrid applications are used for displaying data only. So I thought of adding the functionality (Add, Edit, Modify, Tree View) in the datagrid.

Database :

   Northwind database has been used for the ease, but you need to create two tables to run the application. Database script for the table creation is included in the zip file. The two tables used are :

1) Custs

2) Ords

 Design :

  There are two datagrids in the application, 'dgCustomer' and 'dgOrders'. 'dgCustomer' is a parent datagrid and the child datagrid 'dgOrders' is generated based on the primary key of records of 'dgCustomers'.

Events & Methods Description :

   BindData method is used for binding dgCustomer datagrid.

   dgCustomer_ItemDataBound event is used to bind orders datagrid.

   dgCustomer_ItemCommand event is used for delete & add commands of customer datagrid.

   dgCustomer_EditCommand event is used to edit data of customer datagrid.

   dgCustomer_CancelCommand event is used to cancel edited data of customer datagrid.

   dgCustomer_UpdateCommand event is used to update edited data of customer datagrid.

   dgCustomer_ItemCreated event is used to register orders datagrids events.

 

   bindOrderData method is used for binding dgOrders datagrid.

   dgOrders_ItemDataBound event is used to bind orders datagrid.

   dgOrders_ItemCommand event is used for delete & add commands of Orders datagrid.

   dgOrders_EditCommand event is used to edit data of Orders datagrid.

   dgOrders_CancelCommand event is used to cancel edited data of Orders datagrid.

   dgOrders_UpdateCommand event is used to update edited data of Orders datagrid.

 

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Dinesh Goziya
Web Developer
India India
I am a software engineer working for Microsoft Software Private Limited at Cybage Software Private Limited Pune. I have 3 Years of experience in ASP.NET and .NET Compact framework.

Comments and Discussions

 
QuestionUrjent Query regarding nested grid Pin
dilfizo2-Apr-12 1:11
memberdilfizo2-Apr-12 1:11 
GeneralMy vote of 3 Pin
rkumar6709-Oct-11 19:03
memberrkumar6709-Oct-11 19:03 
Great Article Thank Dinesh For This Great Article
QuestionJScript Error Pin
HariSir28-Nov-07 14:23
memberHariSir28-Nov-07 14:23 
AnswerRe: JScript Error Pin
Nadene17-Aug-09 1:58
memberNadene17-Aug-09 1:58 
GeneralSetting 'Collapse' as the default when the page loads Pin
rabing23-Dec-06 20:00
memberrabing23-Dec-06 20:00 
Generalerror while using inside usercontrol Pin
GayuDams11-Nov-06 0:59
memberGayuDams11-Nov-06 0:59 
GeneralRe: error while using inside usercontrol Pin
Dinesh Goziya12-Nov-06 18:47
memberDinesh Goziya12-Nov-06 18:47 
GeneralRe: error while using inside usercontrol Pin
GayuDams12-Nov-06 19:04
memberGayuDams12-Nov-06 19:04 
GeneralRe: error while using inside usercontrol Pin
GayuDams14-Nov-06 17:22
memberGayuDams14-Nov-06 17:22 
GeneralBinding DataList Within A DataGrid Pin
mshariq12-Jul-06 3:47
membermshariq12-Jul-06 3:47 
Questionhow can I make " dgCustomer" collapse as default case! not expand when i pagelod the page!! Pin
tiger6015-Jun-06 17:40
membertiger6015-Jun-06 17:40 
AnswerRe: how can I make " dgCustomer" collapse as default case! not expand when i pagelod the page!! Pin
tiger6015-Jun-06 17:41
membertiger6015-Jun-06 17:41 
GeneralRe: how can I make " dgCustomer" collapse as default case! not expand when i pagelod the page!! Pin
rabing23-Dec-06 19:57
memberrabing23-Dec-06 19:57 
AnswerRe: how can I make " dgCustomer" collapse as default case! not expand when i pagelod the page!! Pin
mrhamedn7-Feb-07 0:59
membermrhamedn7-Feb-07 0:59 
AnswerRe: how can I make " dgCustomer" collapse as default case! not expand when i pagelod the page!! Pin
mrhamedn7-Feb-07 1:01
membermrhamedn7-Feb-07 1:01 
AnswerRe: how can I make " dgCustomer" collapse as default case! not expand when i pagelod the page!! Pin
mrhamedn7-Feb-07 1:02
membermrhamedn7-Feb-07 1:02 
AnswerRe: how can I make " dgCustomer" collapse as default case! not expand when i pagelod the page!! Pin
Member 132196630-Jul-08 9:50
memberMember 132196630-Jul-08 9:50 
Questionwhere is the article ? Pin
v2.013-Mar-06 4:39
memberv2.013-Mar-06 4:39 
AnswerRe: where is the article ? Pin
Rama Krishna Vavilala13-Mar-06 4:48
memberRama Krishna Vavilala13-Mar-06 4:48 
GeneralRe: where is the article ? Pin
v2.013-Mar-06 4:51
memberv2.013-Mar-06 4:51 
GeneralRe: where is the article ? Pin
Marcello13-Mar-06 9:39
memberMarcello13-Mar-06 9:39 
GeneralRe: where is the article ? Pin
HardikP15-Mar-06 3:10
memberHardikP15-Mar-06 3:10 
GeneralRe: where is the article ? Pin
Dinesh Goziya15-Mar-06 17:25
memberDinesh Goziya15-Mar-06 17:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 13 Mar 2006
Article Copyright 2006 by Dinesh Goziya
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid