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

<%@ Register Assembly="Telerik.OpenAccess.Web.40" Namespace="Telerik.OpenAccess.Web"
	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 id="Head1" runat="server">
	<title>Empty Page</title>
</head>
<body>
	<form runat="server" id="mainForm" method="post">
	<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
	<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
	</telerik:RadAjaxManager>
	<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource">
		<MasterTableView AutoGenerateColumns="False" DataKeyNames="CustomerID"
			AllowFilteringByColumn="true" AllowPaging="true" PageSize="5">
			<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
			<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
				<HeaderStyle Width="20px"></HeaderStyle>
			</RowIndicatorColumn>
			<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
				<HeaderStyle Width="20px"></HeaderStyle>
			</ExpandCollapseColumn>
			<Columns>
				<telerik:GridBoundColumn DataField="CustomerID" FilterControlAltText="Filter CustomerID column"
					HeaderText="CustomerID" ReadOnly="True" SortExpression="CustomerID" UniqueName="CustomerID">
				</telerik:GridBoundColumn>
				<telerik:GridBoundColumn DataField="CompanyName" FilterControlAltText="Filter CompanyName column"
					HeaderText="CompanyName" SortExpression="CompanyName" UniqueName="CompanyName">
				</telerik:GridBoundColumn>
				<telerik:GridBoundColumn DataField="ContactName" FilterControlAltText="Filter ContactName column"
					HeaderText="ContactName" SortExpression="ContactName" UniqueName="ContactName">
				</telerik:GridBoundColumn>
				<telerik:GridTemplateColumn FilterControlAltText="Filter Région column" HeaderText="Région"
					DataField="ContactTitle" SortExpression="Region.Nom" UniqueName="Region" AutoPostBackOnFilter="true"
					CurrentFilterFunction="StartsWith" ShowFilterIcon="true">
					<ItemTemplate>
						<asp:Label runat="server" ID="lblNomRegion" Text='<%# DataBinder.Eval(Container.DataItem, "ContactTitle") %>' />
					</ItemTemplate>
					<EditItemTemplate>
						<telerik:RadComboBox runat="server" ID="RegionRadComboBox" DataTextField="ContactTitle"
							DataValueField="ContactTitle">
						</telerik:RadComboBox>
					</EditItemTemplate>
					<FilterTemplate>
						<telerik:RadComboBox ID="RadComboBoxRegionFilter" DataSourceID="SqlDataSource2" DataTextField="ContactTitle"
							DataValueField="ContactTitle" Height="200px" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Region").CurrentFilterValue %>'
							runat="server" OnClientSelectedIndexChanged="TitleIndexChanged">
							<Items>
								<telerik:RadComboBoxItem Text="All" />
							</Items>
						</telerik:RadComboBox>
						<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
							<script type="text/javascript">
								function TitleIndexChanged(sender, args) {
									var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
									tableView.filter("Region", args.get_item().get_value(), "EqualTo");
								}
							</script>
						</telerik:RadScriptBlock>
					</FilterTemplate>
				</telerik:GridTemplateColumn>
			</Columns>
			<EditFormSettings>
				<EditColumn FilterControlAltText="Filter EditCommandColumn column">
				</EditColumn>
			</EditFormSettings>
		</MasterTableView>
		<FilterMenu EnableImageSprites="False">
		</FilterMenu>
	</telerik:RadGrid>
	<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnection %>"
		SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName], [ContactTitle] FROM [Customers]">
	</asp:SqlDataSource>
	<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnection %>"
		SelectCommand="SELECT DISTINCT [ContactTitle] FROM [Customers]"></asp:SqlDataSource>
	</form>
</body>
</html>
