📄 datagridcolumn.cs
字号:
using System;
namespace System.Web.UI.WebControls
{
/// <summary>
/// Summary description for DataGridColumn.
/// </summary>
public abstract class DataGridColumn : System.Web.UI.IStateManager
{
private System.Web.UI.WebControls.DataGrid owner;
private System.Web.UI.WebControls.TableItemStyle itemStyle;
private System.Web.UI.WebControls.TableItemStyle headerStyle;
private System.Web.UI.WebControls.TableItemStyle footerStyle;
private System.Web.UI.StateBag statebag;
private bool marked;
private bool designMode;
// public DataGridColumn()
// {
// this.statebag = new StateBag();
// }
public DataGridColumn() : base()
{
this.statebag = new StateBag();
}
bool System.Web.UI.IStateManager.get_IsTrackingViewState()
{
return this.IsTrackingViewState;
}
void System.Web.UI.IStateManager.LoadViewState(object state)
{
this.LoadViewState(state);
}
object System.Web.UI.IStateManager.SaveViewState()
{
return this.SaveViewState();
}
void System.Web.UI.IStateManager.TrackViewState()
{
this.TrackViewState();
}
bool System.Web.UI.IStateManager.IsTrackingViewState
{
get
{
return this.IsTrackingViewState;
}
}
public virtual void Initialize()
{
if (this.owner != null && this.owner.Site != null)
this.designMode = this.owner.Site.DesignMode;
}
public virtual void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
{
WebControl local0;
bool local1;
string local2;
string local3;
ImageButton local4;
Image local5;
string local6;
LinkButton local7;
string local8;
ListItemType local9;
local9 = itemType;
switch (local9)
{
case ListItemType.Header:
local0 = null;
local1 = true;
local2 = null;
if (this.owner != null && !(this.owner.AllowSorting))
local1 = false;
if (local1)
{
local2 = this.SortExpression;
if (local2.Length == 0)
local1 = false;
}
local3 = this.HeaderImageUrl;
if (local3.Length != 0)
{
if (local1)
{
local4 = new ImageButton();
local4.ImageUrl = this.HeaderImageUrl;
local4.CommandName = "Sort";
local4.CommandArgument = local2;
local4.CausesValidation = false;
local0 = local4;
goto i0;
}
local5 = new Image();
local5.ImageUrl = local3;
local0 = local5;
}
else
{
local6 = this.HeaderText;
if (local1)
{
local7 = new DataGridLinkButton();
local7.Text = local6;
local7.CommandName = "Sort";
local7.CommandArgument = local2;
local7.CausesValidation = false;
local0 = local7;
}
else
{
if (local6.Length == 0)
local6 = " ";
cell.Text = local6;
}
}
i0: if (local0 == null)
goto i1;
cell.Controls.Add(local0);
return;
break;
case ListItemType.Footer:
local8 = this.FooterText;
if (local8.Length == 0)
local8 = " ";
cell.Text = local8;
return;
i1: return;
break;
default:
return;
}
}
protected virtual void TrackViewState()
{
this.marked = true;
this.ViewState.TrackViewState();
if (this.itemStyle != null)
this.itemStyle.TrackViewState();
if (this.headerStyle != null)
this.headerStyle.TrackViewState();
if (this.footerStyle != null)
this.footerStyle.TrackViewState();
if (this.itemStyle != null)
this.itemStyle.TrackViewState();
}
protected virtual void LoadViewState(object savedState)
{
object[] local0;
if (savedState != null)
{
local0 = (object[]) savedState;
if (local0[0] != null)
this.ViewState.LoadViewState(local0[0]);
if (local0[1] != null)
this.ItemStyle.LoadViewState(local0[1]);
if (local0[2] != null)
this.HeaderStyle.LoadViewState(local0[2]);
if (local0[3] != null)
this.FooterStyle.LoadViewState(local0[3]);
}
}
protected virtual object SaveViewState()
{
object local0;
object local1;
object local2;
object local3;
object[] local4;
local0 = this.ViewState.SaveViewState();
local1 = (this.itemStyle != null) ? this.itemStyle.SaveViewState() : null;
local2 = (this.itemStyle != null) ? this.headerStyle.SaveViewState() : null;
local3 = (this.itemStyle != null) ? this.footerStyle.SaveViewState() : null;
if (local0 != null || local1 != null || local2 != null || local3 != null)
{
local4 = new Object[4];
local4[0] = local0;
local4[1] = local1;
local4[2] = local2;
local4[3] = local3;
return local4;
}
return null;
}
protected bool IsTrackingViewState
{
get
{
return this.marked;
}
}
protected StateBag ViewState
{
get
{
return this.statebag;
}
}
public virtual TableItemStyle HeaderStyle
{
get
{
if (this.headerStyle == null)
{
this.headerStyle = new TableItemStyle();
if (this.IsTrackingViewState)
this.headerStyle.TrackViewState();
}
return this.headerStyle;
}
}
public virtual TableItemStyle ItemStyle
{
get
{
if (this.itemStyle == null)
{
this.itemStyle = new TableItemStyle();
if (this.IsTrackingViewState)
this.itemStyle.TrackViewState();
}
return this.itemStyle;
}
}
public virtual TableItemStyle FooterStyle
{
get
{
if (this.footerStyle == null)
{
this.footerStyle = new TableItemStyle();
if (this.IsTrackingViewState)
this.footerStyle.TrackViewState();
}
return this.footerStyle;
}
}
internal void SetOwner(DataGrid owner)
{
this.owner = owner;
}
protected virtual void OnColumnChanged()
{
if (this.owner != null)
this.owner.OnColumnsChanged();
}
public virtual string FooterText
{
get
{
object local0;
local0 = this.ViewState["FooterText"];
if (local0 != null)
return (String) local0;
return System.String.Empty;
}
}
public virtual string HeaderText
{
get
{
object local0;
local0 = this.ViewState["HeaderText"];
if (local0 != null)
return (String) local0;
return System.String.Empty;
}
set
{
this.ViewState["HeaderText"] = value;
this.OnColumnChanged();
}
}
public virtual string SortExpression
{
get
{
object local0;
local0 = this.ViewState["SortExpression"];
if (local0 != null)
return (String) local0;
return System.String.Empty;
}
set
{
this.ViewState["SortExpression"] = value;
this.OnColumnChanged();
}
}
public bool Visible
{
get
{
throw new Exception("TODO");
}
set
{
throw new Exception("TODO");
}
}
protected bool DesignMode
{
get
{
return this.designMode;
}
}
internal TableItemStyle FooterStyleInternal
{
get
{
return this.footerStyle;
}
set
{
this.footerStyle = value;
}
}
internal TableItemStyle ItemStyleInternal
{
get
{
return this.itemStyle;
}
set
{
this.itemStyle = value;
}
}
protected DataGrid Owner
{
get
{
return this.owner;
}
}
public virtual string HeaderImageUrl
{
get
{
object local0;
local0 = this.ViewState["HeaderImageUrl"];
if (local0 != null)
return (String) local0;
return System.String.Empty;
}
set
{
this.ViewState["HeaderImageUrl"]= value;
this.OnColumnChanged();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -