<%@ Page Title="Products By Categories" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="GridViewGroupingProductsByCategories.aspx.vb" Inherits="Northwind45.GridViewGroupingProductsByCategories" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <%: Scripts.Render("~/Scripts/gridview-accordion-script.js"%>
    <script type="text/javascript">
        $(function () {
            $("#divItems").accordion();
        });
    </script>
</asp:Content>
 
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <div id="divItems">
        <asp:Repeater ID="Repeater1" ItemType="Northwind45.BusinessObject.Categories" SelectMethod="GetRepeaterData" runat="server">
            <ItemTemplate>
                <h3><a href="#">Category Name: <%#: Item.CategoryName %> (<%#: Item.ProductsCollection.Value.Count %>)</a><asp:HiddenField ID="HfCategoryID" Value="<%#: Item.CategoryID %>" runat="server" /></h3>
                <div>
                   <asp:GridView ID="GridView1" runat="server" SelectMethod="GetGridData"
                        AutoGenerateColumns="False" SkinID="GridViewProfessionalNoPagingNoSorting"
                        CellPadding="8" ForeColor="Black" GridLines="Both" CssClass="gridviewGridLines"
                        onrowdatabound="GridView1_RowDataBound">
                        <Columns>
                            <asp:BoundField DataField="ProductID" HeaderText="Product ID" ReadOnly="true" DataFormatString="{0:N0}" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField DataField="ProductName" HeaderText="Product Name" ReadOnly="true" />
                            <asp:BoundField DataField="SupplierID" HeaderText="Supplier ID" ReadOnly="true" DataFormatString="{0:N0}" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField DataField="CategoryID" HeaderText="Category ID" ReadOnly="true" DataFormatString="{0:N0}" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField DataField="QuantityPerUnit" HeaderText="Quantity Per Unit" ReadOnly="true" />
                            <asp:BoundField DataField="UnitPrice" HeaderText="Unit Price" ReadOnly="true" DataFormatString="{0:c}" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField DataField="UnitsInStock" HeaderText="Units In Stock" ReadOnly="true" DataFormatString="{0:N0}" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField DataField="UnitsOnOrder" HeaderText="Units On Order" ReadOnly="true" DataFormatString="{0:N0}" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField DataField="ReorderLevel" HeaderText="Reorder Level" ReadOnly="true" DataFormatString="{0:N0}" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" />
                            <asp:CheckBoxField DataField="Discontinued" HeaderText="Discontinued" ReadOnly="true" />
                        </Columns>
                    </asp:GridView>
                </div>
            </ItemTemplate>
        </asp:Repeater>
    </div>
</asp:Content>