Hi ,
I am using a gridview to bind values from two tables to checkbox. The tables are category and subcategory . I am using Item Template to bind the values to both the checkboxes. The problem has to do with the data binding... The first checkbox lists categories and the second checkbox displays the corresponding subcategory.... But I would like to have a single checkbox for the category and the second checkbox should display the corresponding subcategories. The gridview currently binds data like this:
Category Sub_Categor
Network CCNA
Network CCNP
Programming C#
Programming VB
---------------------------------------------------------------------------------
and I want the gridview to display the values like this
Network CCNA
CCNP
Programming C#
VB
<asp:GridView ID="GridView1" runat="server" AllowPaging="False"
AllowSorting="True" AutoGenerateColumns="False"
DataSourceID="CatSource" Width="366px" CellPadding="4"
ForeColor="#333333" GridLines="Vertical">
<Columns>
<asp:TemplateField >
<HeaderTemplate>
<input type ="checkbox" id="chkAll" name="chkAll" onclick="check(this)" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat ="server" Text='<%# Eval("M_CATPAGES_CAT") %>' TextAlign="Right" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate >
<asp:CheckBox ID="chkSubcat" runat ="server" Text ='<%# Eval("M_PAGES_PAGES") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="CatSource" runat="server" DataSourceMode ="DataSet"
ConnectionString="Driver={MySQL ODBC 3.51 Driver};DATABASE=laqualite;option=0;pwd=cadt12;port=0;server=10.20.18.50;uid=root"
SelectCommand ="Select a.M_PAGES_PAGES,b.M_CATPAGES_CAT from mast_pages_tbl as a inner join
mast_catpages_tbl as b on a.M_PAGES_CATID = b.M_CATPAGES_ID "
ProviderName ="System.Data.Odbc" ></asp:SqlDataSource>