Click here to Skip to main content
15,867,973 members
Articles / Web Development / ASP.NET
Article

Fully functional Nested DataGrid

Rate me:
Please Sign up or sign in to vote.
2.66/5 (24 votes)
13 Mar 20062 min read 127K   3.8K   61   23
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


Written By
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
dilfizo2-Apr-12 1:11 
GeneralMy vote of 3 Pin
RsaBrother's9-Oct-11 19:03
RsaBrother's9-Oct-11 19:03 
QuestionJScript Error Pin
HariSir28-Nov-07 14:23
HariSir28-Nov-07 14:23 
AnswerRe: JScript Error Pin
Nadene17-Aug-09 1:58
Nadene17-Aug-09 1:58 
GeneralSetting 'Collapse' as the default when the page loads Pin
rabing23-Dec-06 20:00
rabing23-Dec-06 20:00 
Generalerror while using inside usercontrol Pin
GayuDams11-Nov-06 0:59
GayuDams11-Nov-06 0:59 
GeneralRe: error while using inside usercontrol Pin
Dinesh Goziya12-Nov-06 18:47
Dinesh Goziya12-Nov-06 18:47 
GeneralRe: error while using inside usercontrol Pin
GayuDams12-Nov-06 19:04
GayuDams12-Nov-06 19:04 
GeneralRe: error while using inside usercontrol Pin
GayuDams14-Nov-06 17:22
GayuDams14-Nov-06 17:22 
GeneralBinding DataList Within A DataGrid Pin
mshariq12-Jul-06 3:47
mshariq12-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
tiger6015-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
tiger6015-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
rabing23-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
mrhamedn7-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
mrhamedn7-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
mrhamedn7-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
Member 132196630-Jul-08 9:50 
It is irrelevant if you came from china or Micronesia. Just ask the question from now on. Ok?
Mind you. If you have serious issues, let me know. I can fix all your issues.Cool | :cool:
Questionwhere is the article ? Pin
toxcct13-Mar-06 4:39
toxcct13-Mar-06 4:39 
AnswerRe: where is the article ? Pin
Rama Krishna Vavilala13-Mar-06 4:48
Rama Krishna Vavilala13-Mar-06 4:48 
GeneralRe: where is the article ? Pin
toxcct13-Mar-06 4:51
toxcct13-Mar-06 4:51 
GeneralRe: where is the article ? Pin
Marcello13-Mar-06 9:39
Marcello13-Mar-06 9:39 
GeneralRe: where is the article ? Pin
HardikP15-Mar-06 3:10
HardikP15-Mar-06 3:10 
GeneralRe: where is the article ? Pin
Dinesh Goziya15-Mar-06 17:25
Dinesh Goziya15-Mar-06 17:25 

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

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