0
votes

I have two table as below

PatientDetail - 1st table name     
PatientId --- primary key
firstname
lastname

Patexam - 2nd table name
PId ---- foreign key of first table PatientId
Exam

The first table is show in gridview as below

<asp:GridView ID="gvDoctorList" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" 
                            AllowPaging="True" AllowSorting="True" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true">
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:CheckBox runat="server" ID="chk" OnCheckedChanged="chk_CheckedChanged" />
                                        <asp:Label runat="server" ID="lblPID" Visible="false" Text='<%# Eval("PatientId") %>'></asp:Label>
                                    </ItemTemplate>

                                </asp:TemplateField>

                                <asp:BoundField DataField="PatientId" HeaderText="PatientId" SortExpression="PatientId" />
                                <asp:BoundField DataField="firstname" HeaderText="firstname" SortExpression="firstname" />
                                <asp:BoundField DataField="lastname" HeaderText="lastname" SortExpression="lastname" />

                                <asp:BoundField DataField="sex" HeaderText="sex" SortExpression="sex" />

                            </Columns>
                        </asp:GridView>
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyDatabaseConnectionString %>" 
                            SelectCommand="SELECT [PatientId],[firstname], [lastname], [sex] FROM [PatientDetails]"></asp:SqlDataSource>

Now When I select one or more row from gridview using checkbox, at that moment I want show the firstname as root node from first table and Exam as child node from second table using treeview.

How it is possible with code???

Thanks

1

1 Answers

0
votes

Have a templatefiled with treeview control. Handle the select row event, pass the selected patientid and get the exam name and fill the values in the tree view.