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

📄 basedatalist.cs

📁 不错的人事管理系统
💻 CS
字号:
using System;

namespace System.Web.UI.WebControls
{
	/// <summary>
	/// Summary description for BaseDataList.
	/// </summary>
	[System.ComponentModel.DefaultEvent("SelectedIndexChanged")]
	[System.ComponentModel.DefaultProperty("DataSource")]
	[System.ComponentModel.Designer("System.Web.UI.Design.WebControls.BaseDataListDesigner, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
	public abstract class BaseDataList : WebControl
	{
		private static object EventSelectedIndexChanged;
		internal const string ItemCountViewStateKey = "_!ItemCount";
		private System.Web.UI.WebControls.DataKeyCollection dataKeysCollection;
		private object dataSource;

		static BaseDataList()
		{
			EventSelectedIndexChanged = new object();
		}

		public BaseDataList()
		{
			//
			// TODO: Add constructor logic here
			//
		}

		protected override void AddParsedSubObject(object obj)
		{
		}

		protected override void CreateChildControls()
		{
			this.Controls.Clear();

			if(this.ViewState[ItemCountViewStateKey] != null)
			{
				this.CreateControlHierarchy(false);
				this.ClearChildViewState();
			}
		}

		protected abstract void CreateControlHierarchy(bool useDataSource);

		public override void DataBind()
		{
			this.OnDataBinding(System.EventArgs.Empty);
		}

		public static bool IsBindableType(System.Type type)
		{

			return ((type.IsPrimitive)
				|| (type == typeof(string))
				|| (type == typeof(DateTime))
				|| (type == typeof(decimal))
				);
		}

		protected override void  OnDataBinding(System.EventArgs e) 
		{
			base.OnDataBinding(e);

			this.Controls.Clear();
			this.ClearChildViewState();

			this.CreateControlHierarchy(true);
			this.ChildControlsCreated = true;
			this.TrackViewState();
		}

		protected virtual void  OnSelectedIndexChanged(System.EventArgs e) 
		{
			System.EventHandler V_0;

			V_0 = (System.EventHandler)this.Events[EventSelectedIndexChanged];
			if(V_0 != null)
			{
				V_0(this,e);
			}
		}

		protected override void Render(System.Web.UI.HtmlTextWriter writer) 
		{
			this.PrepareControlHierarchy();
			this.RenderContents(writer);
		}

		protected abstract void PrepareControlHierarchy();

		[System.Web.WebSysDescription("BaseDataList_OnSelectedIndexChanged")]
		[System.Web.WebCategory("Action")]
		public event System.EventHandler SelectedIndexChanged
		{
			add
			{
				this.Events.AddHandler(EventSelectedIndexChanged, value);
			}
			remove
			{
				this.Events.RemoveHandler(EventSelectedIndexChanged, value);
			}
		}

		public virtual int CellPadding
		{
			get
			{
				if(!(this.ControlStyleCreated))
				{
					return(-1);
				}

				return ((TableStyle)this.ControlStyle).CellPadding;
			}
			set
			{
				((TableStyle)this.ControlStyle).CellPadding = value;
			}
		}

		public virtual int CellSpacing
		{
			get
			{
				if(!(this.ControlStyleCreated))
				{
					return(-1);
				}

				return ((TableStyle)this.ControlStyle).CellSpacing;
			}
			set
			{
				((TableStyle)this.ControlStyle).CellSpacing = value;
			}
		}

		public override ControlCollection Controls
		{
			get
			{
				this.EnsureChildControls();
				return(base.Controls);
			}
		}

		public virtual string DataKeyField
		{
			get
			{
				object V_0;

				V_0 = this.ViewState["DataKeyField"];

				if(V_0 != null)
				{
					return((string)V_0);
				}

				return(string.Empty);
			}
			set
			{
				this.ViewState["DataKeyField"] = value;
			}
		}

		public System.Web.UI.WebControls.DataKeyCollection DataKeys
		{
			get
			{
				if(this.dataKeysCollection == null)
				{
					this.dataKeysCollection = new System.Web.UI.WebControls.DataKeyCollection(this.DataKeysArray);
				}

				return(this.dataKeysCollection);
			}
		}

		public virtual object DataSource
		{
			get
			{
				return this.dataSource;
			}
			set
			{
				if((value != null)
					|| (value is System.ComponentModel.IListSource)
					|| (value is System.Collections.IEnumerable)
					)
				{
					this.dataSource = value;
				}
				else
				{
					throw new System.ArgumentException(
						HttpRuntime.FormatResourceString("Invalid_DataSource_Type", this.ID)
						);
				}
			}
		}
		

		protected System.Collections.ArrayList DataKeysArray
		{
			get
			{
				object V_0;

				V_0 = this.ViewState["DataKeys"];

				if(V_0 != null)
				{
					V_0 = new System.Collections.ArrayList();
					this.ViewState["DataKeys"] = V_0;
				}

				return (System.Collections.ArrayList)V_0;
			}
		}

		public virtual string DataMember
		{
			get
			{
				object V_0;

				V_0 = this.ViewState["DataMember"];

				if(V_0 != null)
				{
					return((string)V_0);
				}

				return(string.Empty);
			}
			set
			{
				this.ViewState["DataMember"] = value;
			}
		}

		public virtual System.Web.UI.WebControls.GridLines GridLines
		{
			get
			{
				if(!(this.ControlStyleCreated))
				{
					return(System.Web.UI.WebControls.GridLines.Both);
				}

				return ((TableStyle)this.ControlStyle).GridLines;
			}
			set
			{
				((TableStyle)this.ControlStyle).GridLines = value;
			}
		}

		public virtual System.Web.UI.WebControls.HorizontalAlign HorizontalAlign
		{
			get
			{
				if(!(this.ControlStyleCreated))
				{
					return(System.Web.UI.WebControls.HorizontalAlign.NotSet);
				}

				return ((TableStyle)this.ControlStyle).HorizontalAlign;
			}
			set
			{
				((TableStyle)this.ControlStyle).HorizontalAlign = value;
			}
		}
	}
}

⌨️ 快捷键说明

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