⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultcs.aspx.cs

📁 Telerik是很大的第三方软件制造商
💻 CS
字号:
using System;
using System.Collections;
using System.Web.UI.WebControls;
using Telerik.QuickStart;
using Telerik.QuickStart.Grid;
using Telerik.WebControls;

namespace Telerik.GridExamplesCSharp.Client.Scrolling
{
	public abstract class DefaultCS : XhtmlPage
	{
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.CheckBox CheckBox1;
		protected System.Web.UI.WebControls.CheckBox CheckBox2;
		protected System.Web.UI.WebControls.CheckBox CheckBox3;
		protected System.Web.UI.WebControls.CheckBox CheckBox4;
		protected System.Web.UI.WebControls.DropDownList DropDownList1;
		protected System.Web.UI.WebControls.Label Label1;
		protected Telerik.WebControls.RadGrid RadGrid1;

		private void RadGrid1_NeedDataSource(object source, Telerik.WebControls.GridNeedDataSourceEventArgs e)
		{
			RadGrid1.DataSource = DataSourceHelperCS.GetDataTable("SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, PostalCode FROM Customers");
		}

		private void CheckedChanged(object sender, System.EventArgs e)
		{
			switch((sender as CheckBox).ID)
			{
				case "CheckBox1": 
					RadGrid1.ClientSettings.Scrolling.AllowScroll = CheckBox1.Checked;
					break;
				case "CheckBox2": 
					RadGrid1.ClientSettings.Scrolling.UseStaticHeaders = CheckBox2.Checked;
					break;
				case "CheckBox3": 
					RadGrid1.ShowHeader = CheckBox3.Checked;
					break;
				case "CheckBox4": 
					RadGrid1.ShowFooter = CheckBox4.Checked;
					break;
			}
		}

		private void DropDownListChanged(object sender, System.EventArgs e)
		{
			switch((sender as DropDownList).SelectedIndex)
			{
				case 0: 
					RadGrid1.PagerStyle.Position = GridPagerPosition.Top;
					break;
				case 1: 
					RadGrid1.PagerStyle.Position = GridPagerPosition.Bottom;
					break;
				case 2: 
					RadGrid1.PagerStyle.Position = GridPagerPosition.TopAndBottom;
					break;
			}
		}


		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.CheckBox1.CheckedChanged += new System.EventHandler(this.CheckedChanged);
			this.CheckBox2.CheckedChanged += new System.EventHandler(this.CheckedChanged);
			this.CheckBox3.CheckedChanged += new System.EventHandler(this.CheckedChanged);
			this.CheckBox4.CheckedChanged += new System.EventHandler(this.CheckedChanged);
			this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownListChanged);
			this.RadGrid1.NeedDataSource += new Telerik.WebControls.GridNeedDataSourceEventHandler(this.RadGrid1_NeedDataSource);
			this.Init += new System.EventHandler(this.Page_Init);

		}
		#endregion

		private void Page_Init(object sender, System.EventArgs e)
		{
			if (!IsPostBack)
			{
				ArrayList DropDownListDataSource = new ArrayList();

				DropDownListDataSource.Add("Top");
				DropDownListDataSource.Add("Bottom");
				DropDownListDataSource.Add("TopAndBottom");

				DropDownList1.DataSource = DropDownListDataSource;
				DropDownList1.DataBind();

				switch(RadGrid1.PagerStyle.Position)
				{
					case GridPagerPosition.Top: 
						DropDownList1.SelectedIndex = 0;
						break;
					case GridPagerPosition.Bottom: 
						DropDownList1.SelectedIndex = 1;
						break;
					case GridPagerPosition.TopAndBottom: 
						DropDownList1.SelectedIndex = 2;
						break;
				}
	
				CheckBox1.Checked = RadGrid1.ClientSettings.Scrolling.AllowScroll;
				CheckBox2.Checked = RadGrid1.ClientSettings.Scrolling.UseStaticHeaders;
				CheckBox3.Checked = RadGrid1.ShowHeader;
				CheckBox4.Checked = RadGrid1.ShowFooter;
			}


	}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -