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

📄 defaultcs.aspx.cs

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

namespace Telerik.TabStripExamplesCS.Programming.AddRemoveDisable
{
	/// <summary>
	/// Summary description for DefaultCS.
	/// </summary>
	public class DefaultCS : XhtmlPage
	{
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.Button Button2;
		protected System.Web.UI.WebControls.Button Button3;
		protected System.Web.UI.WebControls.Button Button4;
		protected Telerik.WebControls.RadTabStrip RadTabStrip2;
		protected Telerik.WebControls.RadTabStrip RadTabStrip3;
		protected System.Web.UI.WebControls.Button Button5;
		protected RadTabStrip RadTabStrip1;
	
		private void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				FillTabStrip(RadTabStrip1);
				FillTabStrip(RadTabStrip2);
				FillTabStrip(RadTabStrip3);
			}
		}

		private void FillTabStrip(RadTabStrip tabStrip)
		{
			for (int i = 0; i < 4; i++)
			{
				Tab tab = new Tab();
				tab.Text = string.Format("Root Level Tab {0}", i);
				tabStrip.Tabs.Add(tab);
			}
			tabStrip.SelectedIndex = 0;
		}

		#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);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Button1.Click += new System.EventHandler(this.Button1_Click);
			this.Button2.Click += new System.EventHandler(this.Button2_Click);
			this.Button4.Click += new System.EventHandler(this.Button4_Click);
			this.Button3.Click += new System.EventHandler(this.Button3_Click);
			this.Button5.Click += new System.EventHandler(this.Button5_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void Button1_Click(object sender, System.EventArgs e)
		{
			Tab currentTab = RadTabStrip1.InnerMostSelectedTab;
			
			if (currentTab != null)
			{
				Tab child = new Tab();
				child.Width = Unit.Pixel(60);
				currentTab.Tabs.Add(child);
				child.Text = string.Format("Child Tab {0}", currentTab.Tabs.Count);
			}
		}

		private void Button2_Click(object sender, System.EventArgs e)
		{
			Tab currentTab = RadTabStrip2.InnerMostSelectedTab;
			
			if (currentTab != null)
			{
				ITabContainer owner = currentTab.Owner;
				owner.Tabs.Remove(currentTab);
				if (owner.Tabs.Count > 0)
				{
					owner.SelectedIndex = 0;	
				}
			}
		}

		private void Button3_Click(object sender, System.EventArgs e)
		{
			Tab currentTab = RadTabStrip3.InnerMostSelectedTab;
			
			if (currentTab != null)
			{
				currentTab.Enabled = false;
			}
		}

		private void Button4_Click(object sender, System.EventArgs e)
		{
			RadTabStrip2.Tabs.Clear();
			FillTabStrip(RadTabStrip2);
		}

		private void Button5_Click(object sender, System.EventArgs e)
		{
			RadTabStrip3.Tabs.Clear();
			FillTabStrip(RadTabStrip3);
		}
	}
}

⌨️ 快捷键说明

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