<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxPanel runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
            <telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" AllowSorting="true" PageSize="10" AllowPaging="True"
                AutoGenerateColumns="False" >
                <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
                <MasterTableView Width="100%" EditMode="Batch" CommandItemDisplay="TopAndBottom" DataKeyNames="ProductID" SelectMethod="GetProducts"
                    HorizontalAlign="NotSet" InsertMethod="InsertProduct" DeleteMethod="DeleteProduct" AutoGenerateColumns="False" 
                    UpdateMethod="UpdateProduct" ItemType="Product">
                    <Columns>
                        <telerik:GridBoundColumn DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName"
                            UniqueName="ProductName" ColumnEditorID="GridTextBoxColumnEditor1">
                        </telerik:GridBoundColumn>
                        <telerik:GridNumericColumn DataField="UnitsInStock" HeaderText="Units In Stock" SortExpression="UnitsInStock"
                            UniqueName="UnitsInStock" ColumnEditorID="GridNumericColumnEditor1">
                        </telerik:GridNumericColumn>
                        <telerik:GridBoundColumn DataField="QuantityPerUnit" HeaderText="Quantity Per Unit"
                            SortExpression="QuantityPerUnit" UniqueName="QuantityPerUnit" Visible="false"
                            EditFormColumnIndex="1" ColumnEditorID="GridTextBoxColumnEditor2">
                        </telerik:GridBoundColumn>
                        <telerik:GridCheckBoxColumn DataField="Discontinued" HeaderText="Discontinued" SortExpression="Discontinued"
                            UniqueName="Discontinued" EditFormColumnIndex="1">
                        </telerik:GridCheckBoxColumn>
                        <telerik:GridTemplateColumn HeaderText="UnitPrice" SortExpression="UnitPrice" UniqueName="TemplateColumn"
                            EditFormColumnIndex="1">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblUnitPrice" Text='<%# Item.UnitPrice.HasValue ? Item.UnitPrice.Value.ToString("C") : "" %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <span>
                                    <telerik:RadNumericTextBox runat="server" ID="tbUnitPrice" Width="40px" DataType="System.Decimal"
                                        DbValue='<%# BindItem.UnitPrice %>'>
                                    </telerik:RadNumericTextBox>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                            ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                            UniqueName="DeleteColumn">
                            <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                        </telerik:GridButtonColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </telerik:RadAjaxPanel>
    </form>
</body>
</html>
