tags:

views:

838

answers:

5

How to add child rows in datagrid c#.net windows forms?

+2  A: 

I'm not sure if this is what you're asking, but if you want to append rows you're easiest way is to append them to whatever DataSource you're using before you DataBind()

If this wasn't what you're after, please provide more detail.

Nick Craver
A: 

Usually you bind the datagrid to a dataset. Could you please clarify what you are looking for so that we can get into more detail?

Geoffrey Chetwood
A: 
DataTable myDataTable = new DataTable();
DataGridView myGridView = new DataGridView();
myGridView.DataSource = myDataTable;
DataRow row = myDataTable.Rows.Add(1, 2, 3, 4, 5); //This adds the new row
NotDan
A: 

If you are looking for a nested table, you'll have to go with a third-party control. The DataGridView doesn't support it.

Austin Salonen
It's not pretty, but you can nest: you create a templateField column in your datagridview, edit the template and put a gridview inside it.
theo
A: 

what's third party control? i don't understand :(