greg64429
November 19th, 2008, 11:54 AM
Hello I hope someone can help me. I have 3 Datagrids, dgCategory, dgSubCategory and dgQuestions that are nested in that order with dgCategory the first one with sub inside it and question inside sub.
My problem is I need to loop through them as this application is completely database driven, (Oracle) and for each category there can be multiple sub categories and for each sub category there will be multiple questions.
Here is how it is supposed to be laid out:
Category 1
SubCategory 1a
question 1,2,3... Answer(text box for user input)
SubCategory 1b
question 1,2,3.... Answer(text box)
Category 2
and so on.
I can't figure out how to loop through them to get the layout like is needed. It is written in ASP.Net with VB.Net as the programming language on the .Net 2.0 platform. Here is my code for the DataGrids.
<asp:SqlDataSource ID="dsCatergory" runat="server" SelectCommand="SELECT EMCALL_DATA.TBL_QACALLCATEGORY.* FROM EMCALL_DATA.TBL_QACALLCATEGORY">
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsQuestions" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString4 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString4.ProviderName %>" SelectCommand="SELECT EMCALL_DATA.TBL_QACALLQUESTIONS.* FROM EMCALL_DATA.TBL_QACALLQUESTIONS">
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsSubCategory" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString4 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString4.ProviderName %>" SelectCommand="SELECT EMCALL_DATA.TBL_QACALLSUBCATEGORY.* FROM EMCALL_DATA.TBL_QACALLSUBCATEGORY">
</asp:SqlDataSource>
<asp:GridView ID="dgCategory" runat="server" AutoGenerateColumns="False" DataSourceID="dsCatergory" Width="295px">
<Columns>
<asp:BoundField DataField="PRIMKEY" HeaderText="PRIMKEY" SortExpression="PRIMKEY" />
<asp:BoundField DataField="CATEGORY" HeaderText="CATEGORY" SortExpression="CATEGORY" />
</Columns>
<EmptyDataTemplate>
<asp:GridView ID="dgSubCategory" runat="server" AutoGenerateColumns="False"
DataSourceID="dsSubCategory">
<Columns>
<asp:BoundField DataField="PRIMKEY" HeaderText="PRIMKEY" SortExpression="PRIMKEY" />
<asp:BoundField DataField="SUBNAME" HeaderText="SUBNAME" SortExpression="SUBNAME" />
<asp:BoundField DataField="PARENT" HeaderText="PARENT" SortExpression="PARENT" />
</Columns>
<EmptyDataTemplate>
<asp:GridView ID="dgQuestions" runat="server" AutoGenerateColumns="False" DataSourceID="dsQuestions">
<Columns>
<asp:BoundField DataField="TEXT" HeaderText="TEXT" SortExpression="TEXT" />
</Columns>
<EmptyDataTemplate>
<asp:TextBox ID="txtAnswer" runat="server"></asp:TextBox>
</EmptyDataTemplate>
</asp:GridView>
</EmptyDataTemplate>
</asp:GridView>
</EmptyDataTemplate>
</asp:GridView>
Any Help will be appreciated thank you.
My problem is I need to loop through them as this application is completely database driven, (Oracle) and for each category there can be multiple sub categories and for each sub category there will be multiple questions.
Here is how it is supposed to be laid out:
Category 1
SubCategory 1a
question 1,2,3... Answer(text box for user input)
SubCategory 1b
question 1,2,3.... Answer(text box)
Category 2
and so on.
I can't figure out how to loop through them to get the layout like is needed. It is written in ASP.Net with VB.Net as the programming language on the .Net 2.0 platform. Here is my code for the DataGrids.
<asp:SqlDataSource ID="dsCatergory" runat="server" SelectCommand="SELECT EMCALL_DATA.TBL_QACALLCATEGORY.* FROM EMCALL_DATA.TBL_QACALLCATEGORY">
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsQuestions" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString4 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString4.ProviderName %>" SelectCommand="SELECT EMCALL_DATA.TBL_QACALLQUESTIONS.* FROM EMCALL_DATA.TBL_QACALLQUESTIONS">
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsSubCategory" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString4 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString4.ProviderName %>" SelectCommand="SELECT EMCALL_DATA.TBL_QACALLSUBCATEGORY.* FROM EMCALL_DATA.TBL_QACALLSUBCATEGORY">
</asp:SqlDataSource>
<asp:GridView ID="dgCategory" runat="server" AutoGenerateColumns="False" DataSourceID="dsCatergory" Width="295px">
<Columns>
<asp:BoundField DataField="PRIMKEY" HeaderText="PRIMKEY" SortExpression="PRIMKEY" />
<asp:BoundField DataField="CATEGORY" HeaderText="CATEGORY" SortExpression="CATEGORY" />
</Columns>
<EmptyDataTemplate>
<asp:GridView ID="dgSubCategory" runat="server" AutoGenerateColumns="False"
DataSourceID="dsSubCategory">
<Columns>
<asp:BoundField DataField="PRIMKEY" HeaderText="PRIMKEY" SortExpression="PRIMKEY" />
<asp:BoundField DataField="SUBNAME" HeaderText="SUBNAME" SortExpression="SUBNAME" />
<asp:BoundField DataField="PARENT" HeaderText="PARENT" SortExpression="PARENT" />
</Columns>
<EmptyDataTemplate>
<asp:GridView ID="dgQuestions" runat="server" AutoGenerateColumns="False" DataSourceID="dsQuestions">
<Columns>
<asp:BoundField DataField="TEXT" HeaderText="TEXT" SortExpression="TEXT" />
</Columns>
<EmptyDataTemplate>
<asp:TextBox ID="txtAnswer" runat="server"></asp:TextBox>
</EmptyDataTemplate>
</asp:GridView>
</EmptyDataTemplate>
</asp:GridView>
</EmptyDataTemplate>
</asp:GridView>
Any Help will be appreciated thank you.