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

<%@ Register TagPrefix="custom" Namespace="Telerik.GridExamplesCS.Programming" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server">
        </telerik:RadScriptManager>
        <!-- content start -->
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadGrid ID="RadGrid1" Width="97%"
           Skin="Web20" AllowFilteringByColumn="True" AllowSorting="True" PageSize="12"
            ShowFooter="True" AllowPaging="True" runat="server" AutoGenerateColumns="False"
            GridLines="None" DataSourceID="SqlDataSource1">
            <MasterTableView EditMode="InPlace" AllowFilteringByColumn="True" DataSourceID="SqlDataSource1"
            ShowFooter="True" DataKeyNames="CustomerID" HierarchyLoadMode="ServerOnDemand">
                <Columns>
                    <telerik:GridBoundColumn DataField="ContactName" HeaderText="Contact name">
                        <HeaderStyle Width="30%" />
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn DataField="City" HeaderText="TemplateColumn City">
                        <HeaderStyle Width="30%" />
                        <ItemTemplate>
                            <%# Eval("City") %>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <custom:MyCustomFilteringColumnCS UniqueName="MasterColumn" DataField="Country" HeaderText="Custom TemplateColumn Country">
                        <HeaderStyle Width="30%" />
<%--                        <ItemTemplate>
                             <img src='Img/<%# Eval("Country") %>.gif' alt="" style="vertical-align:middle;margin-right:7px;"/><%# Eval("Country") %>
                        </ItemTemplate>
--%>                    </custom:MyCustomFilteringColumnCS>
                </Columns>
                <DetailTables>
                    <telerik:GridTableView DataKeyNames="OrderID" DataSourceID="SqlDataSource2" 
                    CommandItemDisplay="TopAndBottom" Name="Orders" AutoGenerateColumns="false">
                        <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="CustomerID" MasterKeyField="CustomerID" />
                            </ParentTableRelation>
                        <Columns>
                            <telerik:GridEditCommandColumn UniqueName="EditDetailColumn">
                            </telerik:GridEditCommandColumn>
                            <custom:MyCustomFilteringColumnCS UniqueName="CustomOrderID" DataField="OrderID" HeaderText="OrderID"></custom:MyCustomFilteringColumnCS>
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
            </MasterTableView>

            <PagerStyle Mode="NumericPages"></PagerStyle>
        </telerik:RadGrid>
        <br />
         <asp:SqlDataSource ID="SqlDataSource1" 
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient"
            SelectCommand="SELECT CustomerID, ContactName, Country, City FROM Customers"
            runat="server"></asp:SqlDataSource>
            
        <!-- content end -->
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
            SelectCommand="SELECT Top(100) [OrderID], [CustomerID], [OrderDate], [RequiredDate] FROM [Orders]">
        </asp:SqlDataSource>
    </form>
</body>
</html>
