Hierarchical Datagridviewbuttoncolumn

  1. Hierarchical Datagridviewbuttoncolumns

I am trying to construct a datagridview that will show a number of rows with a particular set of fields, but also allow me to show some 'subrows' ie rows that can be expanded below the parent row in question (if that parent row has these children - part of the datasoruce) the only real problem is that the expanded rows will have completely different fields(columns)

Hierarchical Data Into DataGridView in C# Feb 23, 2012. In this article you will learn how to enter hierarchical data into a DataGridView. You will also learn how to format a DataGridView cell. Populating Values From XML to a DataGridView And From a DataGridView to XML Using C# Feb 19, 2012. Controls / GridView / Columns. Accessing and Iterating through Columns Accessing Columns. You can access any column by name or index. Generally speaking, accessing the columns by name is the preferred approach because if the user reorders the columns the indexes would also change.

is this possible with a standard datagridview in a windows form?I am presuming somehow I would have to shoehorn in a new datagridview in a row of the parent grid.

We do have the Syncfusion suite which includes the gridgroupingcontrol. but after much hair pulling and other pains. I have given up on that completely.

natnat

3 Answers

Short answer: No. You need a custom component for this.

There are a lot of good efforts out there on making a hierarchical treeview. Like in the CodeProject article TreeView with Columns or FlexGrid from Component One (paid). I understand you want different fields on the subnodes though, and I'm unsure to what extent these controls support that. I know FlexGrid support some customization of columns for different rows, but it will probably involve quite some manual work - databinding is not well supported.

Finally, you might want to consider if your idea of a customized GridView is the best approach to your problem in the first place. Could a Master-Detail-view be a better approach?

PS: I'm not affiliated with ComponentOne, but I've used FlexGrid in a project.

NilzorNilzor

Free download facebook software for nokia n97 mini goldendoodle. Yes this can be done.

Set a data relation, either in the dataset designer or in code between the two tables using the foreign key - parent key columns.

If in the dataset designer, set the nested property to true. This will then give you child records under each parent row in the datagrid view.

Hierarchical Datagridviewbuttoncolumn
Nael MahfouzNael Mahfouz
Deepthi KrishnaDeepthi Krishna

Not the answer you're looking for? Browse other questions tagged c#.netdatagridviewexpand or ask your own question.

I'm trying add buttons into DataGridView to delete items from it. To do it, I'm trying to use DataGridViewButtonCell, because I saw that it can contain images. I wan't my button to stay on the first column of DataGridView, but I have an IList that I use as DataSource and I don't know how to add that button to the GridView in this case.

Hierarchical datagridviewbuttoncolumns

How could I do this ?

Here is my code:

I want this.

FernandoPaivaFernandoPaiva

1 Answer

Hierarchical Datagridviewbuttoncolumns

Done. Finally I did what I wanted.

I did.

Finally I added the handler to delete item

Hierarchical Datagridviewbuttoncolumn

The result is

FernandoPaivaFernandoPaiva

Not the answer you're looking for? Browse other questions tagged c#datagridview or ask your own question.