views:

134

answers:

2

In .net objects like DataTable when you have two grids(Master and Detail) and add a row to the second one(Detail), The new row will have the Foreign-Key Values automatically.
How can i do it(I don't use DataTables because they suck)?
thanks.

A: 

bind the two grids to the respective master/detail database tables and set the corresponding primary/foreign key fields using the DataKeyNames attributes

Alan Stephens
Where is DataKeyNames defined?I can't find it.did you mean System.Web....?
Behrooz
it's an attribute of the GridView class if that's what you using to render your data
Alan Stephens
A: 

Here are some articles/papers on how Master-Detail relationship can be implememted with business objects(classes):

http://www.codeproject.com/KB/grid/Bindinglist.aspx

http://msdn.microsoft.com/en-us/library/aa581795.aspx

Aseem Gautam