Link to home
Start Free TrialLog in
Avatar of mahmood66
mahmood66Flag for United Arab Emirates

asked on

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.
Avatar of hamidovt
hamidovt

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

ASKER CERTIFIED SOLUTION
Avatar of graye
graye
Flag of United States of America 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
graye:
No, I was talking about web application!!!

mahmood66:

it is a web or windows application?
have you trued my suggestion???
Avatar of mahmood66

ASKER

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.
graye:

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

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
My orginal suggestion still stands.... use the DataGrid control (instead of the DataGridView control)
okayyyyyyy,  its mean in datagridview, its not possible.
That's correct... that feature is not present in the DataGridView