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

📄 comboitem.cs

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

namespace Bestcomy.Web.UI.WebControls
{
	/// <summary>
	///
	/// </summary>
	[ControlBuilder(typeof(ComboItemControlBuilder)),DesignTimeVisible(false), TypeConverter(typeof(Bestcomy.Web.UI.WebControls.ComboItemConverter))]
	public sealed class ComboItem : IStateManager
	{
		private string _text = string.Empty;
		private string _value = string.Empty;
		private bool _selected = false;
		private bool _IsTrackingViewState = false;

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

		public ComboItem(string text) : this(text, text)
		{
		}

		public ComboItem(string text, string value) : this(text,value,false)
		{
		}

		public ComboItem(string text, string value, bool selected)
		{
			this._text = text;
			this._value = value;
			this._selected = false;
		}

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

		public string Value
		{
			get
			{
				return _value;
			}
			set
			{
				_value = value;
			}
		}

		public bool Selected
		{
			get
			{
				return this._selected;
			}
			set
			{
				this._selected = value;
			}
		}

		#region IStateManager 成员

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

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

		object IStateManager.SaveViewState()
		{
			return new Triplet(this._text,this._value,this._selected);
		}

		void IStateManager.LoadViewState(object state)
		{
			if(state!=null && state is Triplet)
			{
				Triplet t = (Triplet)state;
				this._text = (string)t.First;
				this._value = (string)t.Second;
				this._selected = (bool)t.Third;
			}
		}

		#endregion

	}
}

⌨️ 快捷键说明

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