How can i diplay master and child record in one datagridview

How can i display Master and child records in one datagirdview in vb.net 2005, just to clear my question, I want to state that may be have u seen in Ms access, we can see master and child records in one datagid, with master records + (Pluse) sign comes, when we click on + (Plus) sign, we can see detail record also. I want same like that. I want to display My "Master Taks" and "Sub Taks" in this way.
mahmood66Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hamidovtCommented:
If you details are collection, you can display bind the to the datasource of a web control within a TemplateField. Below is an example code. You can seet the complete solution on http://msdn2.microsoft.com/en-us/library/aa581776.aspx 

For + / -  you will have to do something with JScript....
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="DataWebControlStyle">
                <HeaderStyle CssClass="HeaderStyle" />
                <AlternatingRowStyle CssClass="AlternatingRowStyle" />
                <Columns>
                    <asp:BoundField DataField="CompanyName" HeaderText="Supplier" />
                    <asp:TemplateField HeaderText="Products">
                        <ItemTemplate>
                            <asp:BulletedList ID="BulletedList1" runat="server" DataSource='<%# ((Northwind.SuppliersRow)((System.Data.DataRowView) Container.DataItem).Row).GetProducts() %>'
                                    DataTextField="ProductName">
                            </asp:BulletedList>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>

Open in new window

0
grayeCommented:
I presume you're talking about a Windows Form application?

That's one of the features that didn't make it into the DataGridView control.   There are several work arounds... the easiest is to use two controls.   Other more complex examples are available to force this behavior in a single DataGridView control.

....or, a much simplier approach would be to use the older DataGrid control.   It can handle a master/child relationship without any coding at all
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hamidovtCommented:
graye:
No, I was talking about web application!!!

0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

hamidovtCommented:
mahmood66:

it is a web or windows application?
have you trued my suggestion???
0
mahmood66Author Commented:
actually i was talking about windows application not web application, I haved almost completed my project but this portion is remaining only. that why i was asking if it is possible it will do it for my users, then my application will be more user-friendly.  so please help me in this regards. i will be very very tahnkful u.
0
hamidovtCommented:
graye:

I think you can better help mahmood, because I am not a axpert in windows applications...

0
mahmood66Author Commented:
is there 3rd party utility which we can buy and use for this purpose.  We need + sign if we press plus sign it will expande and sub task will listed. like subfolders in Outlook (Expand and collapse
0
grayeCommented:
My orginal suggestion still stands.... use the DataGrid control (instead of the DataGridView control)
0
mahmood66Author Commented:
okayyyyyyy,  its mean in datagridview, its not possible.
0
grayeCommented:
That's correct... that feature is not present in the DataGridView
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.