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.
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.
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 :
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.
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.