Link to home
Start Free TrialLog in
Avatar of printmedia
printmedia

asked on

Nested datagridview control in VB.NET

Hi all.

I have a datagridview control in Visual Studio 2008 that displays "header" information, but I want to be able to display "detail" information for each row in the datagridview control when the user clicks it. I have attached a screenshot of what the datagridview control looks like right now. Each MasterItemNumber has more than one price details.

For example:

MasterItemNumber: productABC
Price1: $4
Price2: $5.50
Price3: $6

I don't want to display 3 rows with the same header information to be able to show the 3 prices. Instead I would like to show 1 row for each MasterItemNumber and if the end user clicks or double clicks a row then it will display some kind of nested datagridview control with the 3 prices or 4 or 5 prices etc. It is a Windows Form.

Is this possible? If not, what are my alternatives?

Thank you in advance.
Avatar of Jerry Miller
Jerry Miller
Flag of United States of America image

I have not done it with a datagridview control, but with a gridview control. I used this MSDN page as a guideline.

Basically you nest the 'detail' grid as a Templatefield and use the primary key from the parent grid to query the details.

http://msdn.microsoft.com/en-us/library/aa992038(v=vs.90).aspx
Avatar of printmedia
printmedia

ASKER

Thank you. But that is for a web form, the GridView control is not available for Windows Form.
Windows Form version, sorry I missed that line in your question. I submitted a request for attention to see if we can get others involved. I don't do much with the Windows Form apps.
ASKER CERTIFIED SOLUTION
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks James.