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

📄 groupitem.cs

📁 ASP中web自定义控件的使用源码及说明文档
💻 CS
字号:
using System;
using System.ComponentModel;
using System.Web.UI;

namespace Bestcomy.Web.UI.WebControls
{
	/// <summary>
	/// 
	/// </summary>
	[ParseChildren(true,"Items"),PersistChildren(false)]
	public class GroupItem : IStateManager
	{
		private string _text = string.Empty;
		private GroupListItemCollection _items = new GroupListItemCollection();
		private bool _IsTrackingViewState = false;

		public GroupItem() : this(string.Empty)
		{
		}

		public GroupItem(string text)
		{
			_text = text;
		}

		public string Label
		{
			get
			{
				return _text;
			}
			set
			{
				_text = value;
			}
		}

		[DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Editor(typeof(System.ComponentModel.Design.CollectionEditor), typeof(System.Drawing.Design.UITypeEditor)), PersistenceMode(PersistenceMode.InnerDefaultProperty), MergableProperty(false)]
		public GroupListItemCollection Items
		{
			get
			{
				return this._items;
			}
		}

		#region IStateManager 成员

		void IStateManager.TrackViewState()
		{
			_IsTrackingViewState = false;
			((IStateManager)this.Items).TrackViewState();
		}

		[Browsable(false)]
		bool IStateManager.IsTrackingViewState
		{
			get
			{
				return _IsTrackingViewState;
			}
		}

		object IStateManager.SaveViewState()
		{
			return new Pair(this.Label, ((IStateManager)this.Items).SaveViewState());
		}

		void IStateManager.LoadViewState(object state)
		{
			if(state!=null && state is Pair)
			{
				this.Label = (string)((Pair)state).First;
				((IStateManager)this.Items).LoadViewState(((Pair)state).Second);
			}
		}

		#endregion
	}
}

⌨️ 快捷键说明

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