This is a migrated thread and some comments may be shown as answers.

[Solved] update/insert data for the child/details Table of the hierarchical grid.

2 Answers 166 Views
Grid
This is a migrated thread and some comments may be shown as answers.
newbie
Top achievements
Rank 1
newbie asked on 06 May 2008, 08:36 PM
Hi I am trying to update/insert/delete data in the a heirarchical grid from code behind.

I am checking for the dataMember currently to update/insert/delete respectively from master/detail grid.

protected

void myGrid_DeleteCommand(object source, GridCommandEventArgs e)
{

if

(e.Item.OwnerTableView.DataMember == "Orders")
{

DataRow[] deleteRow = AssignmentRailItemDS.Tables["Orders"].Select("OrderID = " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["OrderID"]);
deleteRow[0].Delete();

}

else if (e.Item.OwnerTableView.DataMember == "Products")
{

DataRow[] deleteChildRow = AssignmentRailItemDS.Tables["Products"].Select("ProductID = " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ProductID"]);
deleteChildRow[0].Delete();

}

}

Is this the right approach?
Can I have a working example of the insert/delete operations?

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 May 2008, 05:18 AM
Hi Newbie,

Check out the online demo given below.
Update/Insert/Delete in hierarchy

Thanks
Shinu.
0
newbie
Top achievements
Rank 1
answered on 07 May 2008, 05:57 AM
Thanks for the response.
But the example mentioned ues automaic operations
I want to do it from my code behind. Can I have an example of that.
Tags
Grid
Asked by
newbie
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
newbie
Top achievements
Rank 1
Share this question
or