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

📄 boundcolumn.cs

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

namespace System.Web.UI.WebControls
{
	/// <summary>
	/// Summary description for BoundColumn.
	/// </summary>
	public class BoundColumn : DataGridColumn
	{
		public static string thisExpr;
		private System.ComponentModel.PropertyDescriptor boundFieldDesc;
		private bool boundFieldDescValid;
		private string boundField;
		private string formatting;

		static BoundColumn() 
		{
			BoundColumn.thisExpr = "!";
		}

		public BoundColumn() : base()
		{
		}

		protected virtual string FormatDataValue(object dataValue) 
		{
			string local0;

			local0 = System.String.Empty;
			if (dataValue != null && dataValue != System.DBNull.Value) 
			{
				if (this.formatting.Length == 0)
					local0 = dataValue.ToString();
				else
					local0 = System.String.Format(this.formatting, dataValue);
			}
			return local0;
		}

		public virtual void Initialize() 
		{
			this.Initialize();
			this.boundFieldDesc = null;
			this.boundFieldDescValid = false;
			this.boundField = this.DataField;
			this.formatting = this.DataFormatString;
		}

		
		public virtual void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) 
		{
			Control local0;
			Control local1;
			TextBox local2;
			ListItemType local3;

			this.InitializeCell(cell, columnIndex, itemType);
			local0 = null;
			local1 = null;
			local3 = itemType;
			switch (local3) 
			{
				case ListItemType.Item:
					goto case ListItemType.SelectedItem;
				case ListItemType.AlternatingItem:
					goto case ListItemType.SelectedItem;
				case ListItemType.SelectedItem:
					if (this.DataField.Length == 0)
					{
						break;
					}
					local1 = cell;
					break;
				case ListItemType.EditItem:
					if (this.ReadOnly)
					{
						//goto i0;
					}
					local2 = new TextBox();
					local0 = local2;
					if (this.boundField.Length != 0)
						local1 = local2;
					break;
			}

			if (local0 != null)
			{
				//cell.Controls.Add(local0);
			}

			if (local1 != null)
			{
				//local1.add_DataBinding(new EventHandler(this, OnDataBindColumn));
			}
		}

		
		private void OnDataBindColumn(object sender, EventArgs e) 
		{
//			Control local0;
//			DataGridItem local1;
//			object local2;
//			object local3;
//			string local4;
//
//			local0 = (Control) sender;
//			local1 = (DataGridItem) local0.NamingContainer;
//			local2 = local1.DataItem;
//			if (!(this.boundFieldDescValid)) 
//			{
//				if (this.boundField != BoundColumn.thisExpr) 
//				{
//					this.boundFieldDesc = System.ComponentModel.TypeDescriptor.GetProperties(local2).Find(this.boundField, true);
//					if (this.boundFieldDesc == null && !(this.DesignMode))
//						throw new HttpException(System.Web.HttpRuntime.FormatResourceString("Field_Not_Found", this.boundField));
//				}
//				this.boundFieldDescValid = 1;
//			}
//			local3 = local2;
//			if (this.boundFieldDesc == null && this.DesignMode)
//				local4 = System.Web.SR.GetString("Sample_Databound_Text");
//			else 
//			{
//				if (this.boundFieldDesc != null)
//					local3 = this.boundFieldDesc.GetValue(local2);
//				local4 = this.FormatDataValue(local3);
//			}
//			if (local0 as TableCell != null) 
//			{
//				if (local4.Length == 0)
//					local4 = "&nbsp;";
//				(TableCell) local0.Text = local4;
//				return;
//			}
//			(TextBox) local0.Text = local4;
		}

		public virtual string DataField
		{
			get
			{
				object local0;

				local0 = this.ViewState["DataField"];
				if (local0 != null)
					return (String) local0;
				return System.String.Empty;
			}
			set
			{
				this.ViewState["DataField"] = value;
				this.OnColumnChanged();
			}
		}

		public virtual string DataFormatString
		{
			get
			{
				object local0;

				local0 = this.ViewState["DataFormatString"];
				if (local0 != null)
					return (String) local0;
				return System.String.Empty;
			}
			set
			{
				this.ViewState["DataFormatString"] = value;
				this.OnColumnChanged();
			}
		}


		public virtual bool ReadOnly
		{
			get
			{
				object local0;

				local0 = this.ViewState["ReadOnly"];
				if (local0 != null)
					return (bool) local0;
				return(false);
			}
			set
			{
				this.ViewState["ReadOnly"] = value;
			}
		}
	}
}

⌨️ 快捷键说明

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