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?
 
grayeConnect With a Mentor Commented:
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
 
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
 
hamidovtCommented:
graye:
No, I was talking about web application!!!

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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
All Courses

From novice to tech pro — start learning today.