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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
	<title>RadGrid</title>


	<script type="text/javascript">
		function onGridCreated(sender, args)
		{
			if (typeof sender.ClientSettings.Scrolling.AllowScroll == "undefined")
			{
				return false;
			}

			var gridID = sender.get_id();
			var dataDiv = sender.get_masterTableView().get_element().parentNode;
			var maxScrollWidth = dataDiv.scrollWidth - dataDiv.clientWidth;

			if (sender.ClientSettings.Scrolling.FrozenColumnsCount)
			{
				$get(gridID + '_Frozen').scrollLeft = maxScrollWidth;
			}
			else
			{
				dataDiv.scrollLeft = maxScrollWidth;
			}
		}
	</script>
</head>
<body>
	<form id="form1" runat="server">
		<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
		</telerik:RadScriptManager>
		<div>
			<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" GridLines="None"
				AllowSorting="True" AllowPaging="True" PageSize="50" Width="750px" CellSpacing="0" OnItemCreated="RadGrid1_ItemCreated">
				<ClientSettings>
					<Scrolling AllowScroll="true" UseStaticHeaders="True" FrozenColumnsCount="0"></Scrolling>
				</ClientSettings>
				<MasterTableView AutoGenerateColumns="False" DataKeyNames="CustomerID" HeaderStyle-Width="150px">
					<Columns>
						<telerik:GridBoundColumn DataField="CustomerID" FilterControlAltText="Filter CustomerID column" HeaderText="CustomerID" ReadOnly="True" SortExpression="CustomerID" UniqueName="CustomerID">
							<ColumnValidationSettings>
								<ModelErrorMessage Text="" />
							</ColumnValidationSettings>
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="CompanyName" FilterControlAltText="Filter CompanyName column" HeaderText="CompanyName" SortExpression="CompanyName" UniqueName="CompanyName">
							<ColumnValidationSettings>
								<ModelErrorMessage Text="" />
							</ColumnValidationSettings>
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="ContactName" FilterControlAltText="Filter ContactName column" HeaderText="ContactName" SortExpression="ContactName" UniqueName="ContactName">
							<ColumnValidationSettings>
								<ModelErrorMessage Text="" />
							</ColumnValidationSettings>
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="ContactTitle" FilterControlAltText="Filter ContactTitle column" HeaderText="ContactTitle" SortExpression="ContactTitle" UniqueName="ContactTitle">
							<ColumnValidationSettings>
								<ModelErrorMessage Text="" />
							</ColumnValidationSettings>
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="Address" FilterControlAltText="Filter Address column" HeaderText="Address" SortExpression="Address" UniqueName="Address">
							<ColumnValidationSettings>
								<ModelErrorMessage Text="" />
							</ColumnValidationSettings>
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="City" FilterControlAltText="Filter City column" HeaderText="City" SortExpression="City" UniqueName="City">
							<ColumnValidationSettings>
								<ModelErrorMessage Text="" />
							</ColumnValidationSettings>
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="Region" FilterControlAltText="Filter Region column" HeaderText="Region" SortExpression="Region" UniqueName="Region">
							<ColumnValidationSettings>
								<ModelErrorMessage Text="" />
							</ColumnValidationSettings>
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="PostalCode" FilterControlAltText="Filter PostalCode column" HeaderText="PostalCode" SortExpression="PostalCode" UniqueName="PostalCode">
							<ColumnValidationSettings>
								<ModelErrorMessage Text="" />
							</ColumnValidationSettings>
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="Country" FilterControlAltText="Filter Country column" HeaderText="Country" SortExpression="Country" UniqueName="Country">
							<ColumnValidationSettings>
								<ModelErrorMessage Text="" />
							</ColumnValidationSettings>
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="Phone" FilterControlAltText="Filter Phone column" HeaderText="Phone" SortExpression="Phone" UniqueName="Phone">
							<ColumnValidationSettings>
								<ModelErrorMessage Text="" />
							</ColumnValidationSettings>
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="Fax" FilterControlAltText="Filter Fax column" HeaderText="Fax" SortExpression="Fax" UniqueName="Fax">
							<ColumnValidationSettings>
								<ModelErrorMessage Text="" />
							</ColumnValidationSettings>
						</telerik:GridBoundColumn>
						<telerik:GridCheckBoxColumn DataField="Bool" DataType="System.Boolean" FilterControlAltText="Filter Bool column" HeaderText="Bool" SortExpression="Bool" UniqueName="Bool">
						</telerik:GridCheckBoxColumn>
					</Columns>
				</MasterTableView>
				<ClientSettings>
					<ClientEvents OnGridCreated="onGridCreated" />
				</ClientSettings>

				<FilterMenu EnableImageSprites="False"></FilterMenu>
			</telerik:RadGrid>
		</div>
		<asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT * FROM [Customers]"
			runat="server"></asp:SqlDataSource>
	</form>
</body>
</html>
