📄 extendedgridview.cs
字号:
protected void TxtMaxPerPage_TextChanged(object sender, EventArgs e)
{
int pageSize;
TextBox box = (TextBox) sender;
if (!int.TryParse(box.Text, out pageSize))
{
pageSize = this.PageSize;
}
else if (pageSize < 1)
{
pageSize = this.PageSize;
}
this.PageSize = pageSize;
this.PageIndex = 0;
box.Text = pageSize.ToString();
if (this.IsHoldState)
{
this.Context.Session[this.m_UniqueControlPageSize] = this.PageSize;
}
}
[Bindable(true), DefaultValue(false), Localizable(true), Category("自定义"), Description("是否自动生成复选框列")]
public bool AutoGenerateCheckBoxColumn
{
get
{
object obj2 = this.ViewState["AutoGenerateCheckBoxColumn"];
if (obj2 == null)
{
return false;
}
return (bool) obj2;
}
set
{
this.ViewState["AutoGenerateCheckBoxColumn"] = value;
}
}
[Description("是否显示序号列"), Localizable(true), Category("自定义"), DefaultValue(false), Bindable(true)]
public bool AutoGenerateSerialColumn
{
get
{
object obj2 = this.ViewState["AutoGenerateSerialColumn"];
return ((obj2 != null) && ((bool) obj2));
}
set
{
this.ViewState["AutoGenerateSerialColumn"] = value;
}
}
[Category("自定义"), Bindable(true), DefaultValue(0), Description("复选框列的索引")]
public int CheckBoxColumnIndex
{
get
{
object obj2 = this.ViewState["CheckBoxColumnIndex"];
if (obj2 == null)
{
return 0;
}
return (int) obj2;
}
set
{
this.ViewState["CheckBoxColumnIndex"] = (value < 0) ? 0 : value;
}
}
[DefaultValue(20), Description("复选框列宽度"), Localizable(true), Bindable(true), Category("自定义")]
public Unit CheckBoxFieldHeaderWidth
{
get
{
object obj2 = this.ViewState["CheckBoxFieldHeaderWidth"];
if (obj2 == null)
{
return Unit.Percentage(3.0);
}
return (Unit) obj2;
}
set
{
this.ViewState["CheckBoxFieldHeaderWidth"] = value;
}
}
[DefaultValue(false), Description("是否保持当前状态"), Localizable(true), Category("自定义"), Bindable(true)]
public bool IsHoldState
{
get
{
object obj2 = this.ViewState["IsHoldState"];
if (obj2 != null)
{
return (bool) obj2;
}
return true;
}
set
{
this.ViewState["IsHoldState"] = value;
}
}
[Localizable(true), Description("分页导航处显示的项目名称"), DefaultValue("记录"), Bindable(true), Category("自定义")]
public string ItemName
{
get
{
string str = (string) this.ViewState["ItemName"];
if (str != null)
{
return str;
}
return "记录";
}
set
{
this.ViewState["ItemName"] = value;
}
}
[Bindable(true), Localizable(true), DefaultValue("条"), Category("自定义"), Description("分页导航处显示的项目单位")]
public string ItemUnit
{
get
{
string str = (string) this.ViewState["ItemUnit"];
if (str != null)
{
return str;
}
return "条";
}
set
{
this.ViewState["ItemUnit"] = value;
}
}
[Bindable(true), Category("自定义"), DefaultValue(""), Localizable(true), Description("鼠标移动到数据行上显示的CSS效果")]
public string MouseOverCssClass
{
get
{
string str = (string) this.ViewState["MouseOverCssClass"];
if (str != null)
{
return str;
}
return string.Empty;
}
set
{
this.ViewState["MouseOverCssClass"] = value;
}
}
public override int PageIndex
{
set
{
base.PageIndex = value;
if (!base.DesignMode)
{
this.Context.Session[this.m_UniqueControlPageIndex] = value;
}
}
}
public override int PageSize
{
set
{
base.PageSize = value;
if (!base.DesignMode)
{
this.Context.Session[this.m_UniqueControlPageSize] = value;
}
}
}
[DefaultValue(""), Description("行双击时绑定的数据列"), Bindable(true), Category("自定义")]
public virtual string RowDblclickBoundField
{
get
{
string str = (string) this.ViewState["RowDblclickBoundField"];
if (str != null)
{
return str;
}
return string.Empty;
}
set
{
this.ViewState["RowDblclickBoundField"] = value;
}
}
[Bindable(true), Description("行双击时跳转的URL,可以包含{$Field}来代替绑定的数据列,比如:UserShow.aspx?UserID={$Field}"), DefaultValue(""), Category("自定义")]
public virtual string RowDblclickUrl
{
get
{
string str = (string) this.ViewState["RowDblclickUrl"];
if (str != null)
{
return str;
}
return string.Empty;
}
set
{
this.ViewState["RowDblclickUrl"] = value;
}
}
[DefaultValue(""), Localizable(true), Description("选中的数据行上显示的CSS效果"), Bindable(true), Category("自定义")]
public string SelectedCssClass
{
get
{
string str = (string) this.ViewState["SelectedCssClass"];
if (str != null)
{
return str;
}
return string.Empty;
}
set
{
this.ViewState["SelectedCssClass"] = value;
}
}
public StringBuilder SelectList
{
get
{
string str = "";
StringBuilder builder = new StringBuilder("");
for (int i = 0; i < this.Rows.Count; i++)
{
CheckBox box = (CheckBox) this.Rows[i].Cells[this.CheckBoxColumnIndex].FindControl("CheckBoxButton");
if (box.Checked)
{
str = this.DataKeys[i].Value.ToString();
if (builder.Length == 0)
{
builder.Append(str);
}
else
{
builder.Append(",");
builder.Append(str);
}
}
}
return builder;
}
}
[Description("序号列的索引"), Localizable(true), Bindable(true), Category("自定义"), DefaultValue(0)]
public int SerialColumnIndex
{
get
{
object obj2 = this.ViewState["SerialColumnIndex"];
if (obj2 != null)
{
return (int) obj2;
}
return 0;
}
set
{
this.ViewState["SerialColumnIndex"] = value;
}
}
[Category("自定义"), Localizable(true), Bindable(true), DefaultValue("名次"), Description("序号列的标题文字")]
public string SerialText
{
get
{
string str = (string) this.ViewState["SerialText"];
if (str != null)
{
return str;
}
return string.Empty;
}
set
{
this.ViewState["SerialText"] = value;
}
}
[Bindable(true), DefaultValue(true), Localizable(true), Category("自定义"), Description("是否显示控件默认的分页导航方式")]
public bool ShowCustomPager
{
get
{
object obj2 = this.ViewState["ShowCustomPager"];
if (obj2 != null)
{
return (bool) obj2;
}
return true;
}
set
{
this.ViewState["ShowCustomPager"] = value;
}
}
public int VirtualItemCount
{
get
{
object obj2 = this.ViewState["VirtualItemCount"];
if (obj2 != null)
{
return (int) obj2;
}
return 0;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -