<%@ Page Title="Products" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="GridView_Products.aspx.cs" Inherits="Northwind45.GridView_Products" %> <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server"> <%: Scripts.Render("~/Scripts/gridview-script.js") %> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server"> <div id="deleteConfirmationDialog"></div> <div id="errorDialog" title="An error occured during item deletion!"></div> <asp:HyperLink ID="HlnkAdd" NavigateUrl="~/AddEdit_Products.aspx?operation=add" ImageUrl="~/Images/Add.gif" ToolTip="Add New Products" runat="server" /> <asp:HyperLink ID="HlnkAddNewRecord" Text="Add New Products" NavigateUrl="~/AddEdit_Products.aspx?operation=add" runat="server" /> <br /><br /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:GridView ID="GridView1" runat="server" DataKeyNames="ProductID" ItemType="Northwind45.BusinessObject.Products" SelectMethod="GetGridData" DeleteMethod="DeleteGridItem" onrowdatabound="GridView1_RowDataBound" onrowcreated="GridView1_RowCreated" SkinID="GridViewProfessional"> <Columns> <asp:BoundField DataField="ProductID" HeaderText="Product ID" ReadOnly="true" SortExpression="ProductID" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField DataField="ProductName" HeaderText="Product Name" ReadOnly="true" SortExpression="ProductName" /> <asp:HyperLinkField DataTextField="SupplierID" HeaderText="Supplier ID" DataNavigateUrlFields="SupplierID" DataNavigateUrlFormatString="~/DetailOkThen_Suppliers.aspx?supplierid={0}" SortExpression="SupplierID" ItemStyle-HorizontalAlign="Right" /> <asp:HyperLinkField DataTextField="CategoryID" HeaderText="Category ID" DataNavigateUrlFields="CategoryID" DataNavigateUrlFormatString="~/DetailOkThen_Categories.aspx?categoryid={0}" SortExpression="CategoryID" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField DataField="QuantityPerUnit" HeaderText="Quantity Per Unit" ReadOnly="true" SortExpression="QuantityPerUnit" /> <asp:BoundField DataField="UnitPrice" HeaderText="Unit Price" ReadOnly="true" SortExpression="UnitPrice" DataFormatString="{0:c}" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField DataField="UnitsInStock" HeaderText="Units In Stock" ReadOnly="true" SortExpression="UnitsInStock" DataFormatString="{0:N0}" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField DataField="UnitsOnOrder" HeaderText="Units On Order" ReadOnly="true" SortExpression="UnitsOnOrder" DataFormatString="{0:N0}" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField DataField="ReorderLevel" HeaderText="Reorder Level" ReadOnly="true" SortExpression="ReorderLevel" DataFormatString="{0:N0}" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" /> <asp:CheckBoxField DataField="Discontinued" HeaderText="Discontinued" ReadOnly="true" SortExpression="Discontinued" ItemStyle-HorizontalAlign="Center" /> <asp:TemplateField> <ItemStyle Width="30px" HorizontalAlign="Center" /> <ItemTemplate> <a href="AddEdit_Products.aspx?operation=update&productid=<%#: Item.ProductID %>" title="Click to edit"><img src="Images/Edit.gif" alt="" style="border: none;" /></a> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemStyle Width="30px" HorizontalAlign="Center" /> <ItemTemplate> <asp:ImageButton ID="IBtnDelete" runat="server" ToolTip="Click to delete" CommandArgument='<%#: Item.ProductID %>' BorderStyle="None" BackColor="Transparent" OnClientClick="javascript:return deleteItem(this.name, this.alt);" ImageUrl="~/Images/Delete.png" AlternateText='<%#: Item.ProductID %>' Width="16" Height="16" CommandName="Delete" /> </ItemTemplate> </asp:TemplateField> </Columns> <EmptyDataTemplate>No records found!</EmptyDataTemplate> </asp:GridView> </ContentTemplate> </asp:UpdatePanel> <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server" DisplayAfter="0"> <ProgressTemplate> <br /> <img src="Images/ActivityIndicator.gif" alt="" /> Processing your request. Please wait.... </ProgressTemplate> </asp:UpdateProgress> </asp:Content>