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

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True"
            AllowFilteringByColumn="true" EnableLinqExpressions="false" DataSourceID="SqlDataSource1"
            GridLines="None" Skin="Vista">
            <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource1" DataKeyNames="UserID"
                CommandItemDisplay="TopAndBottom">
                <Columns>
                    <telerik:GridBoundColumn DataField="UserName" HeaderText="User" UniqueName="UserName">
                    </telerik:GridBoundColumn>
                    <telerik:GridDropDownColumn DataField="ContinentName" HeaderText="Continent" UniqueName="ContinentName"
                        ListValueField="ContinentName" ListTextField="ContinentName" DataSourceID="SqlDataSource1">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="rcbContinents" AppendDataBoundItems="true" runat="server"
                                AutoPostBack="true" DataSourceID="SqlDataSource1" DataTextField="ContinentName"
                                DataValueField="ContinentName" Skin="Vista" OnSelectedIndexChanged="rcbContinents_SelectedIndexChanged"
                                OnPreRender="rcbContinents_PreRender">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" Value="" />
                                </Items>
                            </telerik:RadComboBox>
                        </FilterTemplate>
                    </telerik:GridDropDownColumn>
                    <telerik:GridDropDownColumn DataField="CountryName" HeaderText="Country" UniqueName="CountryName"
                        ListValueField="CountryName" ListTextField="CountryName" DataSourceID="SqlDataSource1">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="rcbCountries" runat="server" AutoPostBack="true" Skin="Vista"
                                DataTextField="CountryName" DataValueField="CountryName" Text="All" EnableLoadOnDemand="true"
                                OnItemsRequested="rcbCountries_ItemsRequested" OnSelectedIndexChanged="rcbCountries_SelectedIndexChanged"
                                OnPreRender="rcbCountries_PreRender">
                            </telerik:RadComboBox>
                        </FilterTemplate>
                    </telerik:GridDropDownColumn>
                    <telerik:GridDropDownColumn DataField="CityName" HeaderText="City" UniqueName="CityName"
                        ListValueField="CityName" ListTextField="CityName" DataSourceID="SqlDataSource1">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="rcbCities" runat="server" AutoPostBack="true" Skin="Vista"
                                DataTextField="CityName" DataValueField="CityName" Text="All" EnableLoadOnDemand="true"
                                OnItemsRequested="rcbCities_ItemsRequested" OnSelectedIndexChanged="rcbCities_SelectedIndexChanged"
                                OnPreRender="rcbCities_PreRender">
                            </telerik:RadComboBox>
                        </FilterTemplate>
                    </telerik:GridDropDownColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ComboGrid %>"
            SelectCommand="SELECT UserID, ContinentID, CountryID, CityID, UserName, ContinentName, CountryName, CityName FROM [ViewAllUsers]"
            DeleteCommand="DELETE FROM [Users] WHERE [ID] = @userID">
            <DeleteParameters>
                <asp:Parameter Name="userID" />
            </DeleteParameters>
        </asp:SqlDataSource>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Vista">
        </telerik:RadAjaxLoadingPanel>
    </div>
    </form>
</body>
</html>
