没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|其它|编辑:郝浩|2005-02-18 12:35:00.000|阅读 1617 次
概述:
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
全编辑WebGrid控件LrcGrid(5)—— 构造函数、变量和属性
LrcGrid从System.Web.UI.WebControls.Table继承,实现INamingContainer接口
元数据属性和构造函数:元数据声明了控件的标签和默认属性,构造函数为控件一些属性指定了默认值.
[
ToolboxData("<{0}:LrcGrid runat=server></{0}:LrcGrid>"),
DefaultProperty("SelSql")
]
public class LrcGrid : System.Web.UI.WebControls.Table,INamingContainer
{
public LrcGrid() : base()
{
Font.Name = "verdana";
Font.Size = FontUnit.Point(8);
BackColor = Color.White;
ForeColor = Color.Black;
BorderStyle = BorderStyle.Outset;
BorderWidth = Unit.Parse("1px");
PagerStyle = PagerStyle.NextPrev;
CurrentPageIndex = 0;
ItemsPerPage = 15;
TotalPages = -1;
IsPager = true;
}
......
声明私有变量:
和分页相关的私有变量
#region 和分页有关的私有变量
// ***********************************************************************
private string CurrentPageText = "<b>第</b> {0} <b>页,共</b> {1}<b>页</b>";
private string NoPageSelectedText = "无选择页.";
private string QueryPageCommandText = "SELECT * FROM " +
"(SELECT TOP {0} * FROM " +
"(SELECT TOP {1} * FROM ({2}) AS t0 ORDER BY {3} {4}) AS t1 " +
"ORDER BY {3} {5}) AS t2 " +
"ORDER BY {3}";
private string QueryCountCommandText = "SELECT COUNT(*) FROM ({0}) AS t0";
// ***********************************************************************
#endregion
和属性有关的私有变量:
char[] chra = {','};
char[] chrb = {'|'};
//private DataSet _ds;
//private DataTable _dt;
private string tabN;
private string _priKey;
private string _editCol = "1";
private string _colsStr = "";
private string _colsStrCN = "";
private string _fkCol = "";
private bool _isSort = true;
private bool _isRowEdit;
private bool _isTabChg = true;
private bool _isDel;
private bool _isAdd;
private string _conn;
private Color _titColor;
控件属性,属性都有注释,不再细述:
/// <summary>
/// 外键指示
/// </summary>
[
Category("关键"),
Description("外键.格式:本表列名|外键列名|要显示的外键列名|外键表名,.....")
]
public string FkCol
{
get{return _fkCol;}
set{_fkCol = value;}
}
/// <summary>
/// 是否显示删除功能
/// </summary>
[
Category("关键"),
Description("是否显示删除功能")
]
public bool IsDel
{
get{return _isDel;}
set{_isDel = value;}
}
/// <summary>
/// 是否显示添加功能
/// </summary>
[
Category("关键"),
Description("是否显示添加功能")
]
public bool IsAdd
{
get{return _isAdd;}
set{_isAdd = value;}
}
/// <summary>
/// 公共属性:显示列名
/// </summary>
[
Category("关键"),
Description("显示列名")
]
public string ColsStrCN
{
get{return _colsStrCN;}
set{_colsStrCN = value;}
}
/// <summary>
/// 主表的表名
/// </summary>
[
Category("关键"),
Description("主表的表名")
]
public string TabN
{
get{return tabN;}
set{tabN = value;}
}
/// <summary>
/// 主表的列名列表
/// </summary>
[
Category("关键"),
Description("主表的列名列表")
]
public string ColsStr
{
get{return _colsStr;}
set{_colsStr = value;}
}
/// <summary>
/// 是否用回车键跳转焦点
/// </summary>
[
Category("关键"),
Description("是否用回车键跳转焦点")
]
public bool IsTabChg
{
get{return _isTabChg;}
set{_isTabChg = value;}
}
/// <summary>
/// 选择SQL语句.注意列名不能用'*'
/// </summary>
[
Category("关键"),
Description("选择SQL语句.注意列名不能用'*'")
]
public string SelSql
{
get{return (string)ViewState["lrcSelSql"];}
set{ViewState["lrcSelSql"] = value;}
}
/// <summary>
/// 主键列名,如有多个请用","隔开
/// </summary>
[
Category("关键"),
Description("主键列名,如有多个请用\",\"隔开")
]
public string PriKey
{
get{return _priKey;}
set{_priKey = value;}
}
/// <summary>
/// 标题行颜色
/// </summary>
[
Category("关键"),
Description("标题行颜色")
]
public Color TitColor
{
get{ return _titColor;}
set{ _titColor = value;}
}
/// <summary>
/// 要进行编辑的列,列名用","隔开,0为不编辑,1为全编辑
/// </summary>
[
Category("关键"),
Description("要进行编辑的列,列名用\",\"隔开,0为不编辑,1为全编辑")
]
public string EditCol
{
get{return _editCol;}
set{_editCol = value;}
}
[
Browsable(false)
]
public string UpdSql
{
get{return ((HtmlInputHidden)(this.FindControl("lrcHid_UpdSql"))).Value;}
}
/// <summary>
/// 是否提供排序功能
/// </summary>
[
Category("关键"),
Description("是否提供排序功能")
]
public bool IsSort
{
get{return _isSort;}
set{_isSort = value;}
}
/// <summary>
/// 可否编辑行
/// </summary>
[
Category("关键"),
Description("可否编辑行")
]
public bool IsRowEdit
{
get{return _isRowEdit;}
set{_isRowEdit = value;}
}
/// <summary>
/// 要绑定室控件的数据集,可以在进行修改,
/// 但是请与以上各属性对应
/// </summary>
[
Browsable(false)
]
public DataSet DbSet
{
get
{
if(ViewState["lrcDs"] != null)
{
DataSet _dbSet = new DataSet();
System.IO.StringReader sr = new
System.IO.StringReader((string)ViewState["lrcDs"]);
_dbSet.ReadXml(sr);
return _dbSet;
}
else
{
return null;
}
}
set
{
if(value != null)
{
System.IO.StringWriter sw = new System.IO.StringWriter();
value.WriteXml(sw);
ViewState["lrcDs"] = sw.ToString();
}
else
{
ViewState["lrcDs"] = null;
}
}
}
/// <summary>
/// 排序字段名
/// 不可在设计时设置
/// </summary>
[
Browsable(false)
]
public string SortField
{
get
{
string s = (string)ViewState["lrcSortField"];
return ((s == null)?String.Empty : s);
}
set
{
ViewState["lrcSortField"] = value;
}
}
/// <summary>
/// 排序类型
/// 不可在设计时设置
/// </summary>
[
Browsable(false)
]
public string SortType
{
get
{
string s = (string)ViewState["lrcSortType"];
return (( s == null)?String.Empty : s);
}
set
{
ViewState["lrcSortType"] = value;
}
}
/// <summary>
/// 数据库连接字符串,默认从 web.config 中读取
/// </summary>
[
Category("关键"),
Description("数据库连接字符串")
]
public string Conn
{
get
{
if(_conn == null || _conn == "")
{
return System.Configuration.ConfigurationSettings.AppSettings["Conn"];
}
else
{
return _conn;
}
}
set{ _conn = value;}
}
/// <summary>
/// 列名数组
/// </summary>
[
Browsable(false)
]
public string[] cols
{
get{return _colsStr.Split(chra);}
}
/// <summary>
/// 显示列名数组
/// </summary>
[
Browsable(false)
]
private string[] colsA
{
get{return _colsStrCN.Split(chra);}
}
/// <summary>
/// 主键列名数组
/// </summary>
[
Browsable(false)
]
public string[] _priKeyAr
{
get{return _priKey.Split(chra);}
}
/// <summary>
/// 主键列索引数组
/// </summary>
[
Browsable(false)
]
public string[] PriKeyIndex
{
get
{
string[] index = new string[_priKeyAr.Length];
for(int i=0;i<_priKeyAr.Length;i++)
{
for(int ii=0;ii<cols.Length;ii++)
{
if(cols[ii] == _priKeyAr[i])
index[i] = ii.ToString();
}
}
return index;
}
}
/// <summary>
/// 编辑列名数组
/// </summary>
[
Browsable(false)
]
public string[] _editColAr
{
get{return _editCol.Split(chra);}
}
/// <summary>
/// 编辑列索引数组
/// </summary>
[
Browsable(false)
]
public string[] EditColIndex
{
get
{
string[] index = new string[_editColAr.Length];
if(_editColAr.Length == 1 && _editColAr[0] == "1")
{
index[0] = "LrcAllEdit";
}
else if(_editColAr.Length == 1 && _editColAr[0] == "0")
{
index[0] = "LrcNoEdit";
}
else
{
for(int i=0;i<_editColAr.Length;i++)
{
for(int ii=0;ii<cols.Length;ii++)
{
if(cols[ii] == _editColAr[i])
index[i] = ii.ToString();
}
}
}
return index;
}
}
/// <summary>
/// 外键列二维数组
/// </summary>
[
Browsable(false)
]
public string[,] FkColArray
{
get
{
if(_fkCol == "")
{
return null;
}
else
{
string[] a = _fkCol.Split(chra);
int num = a.Length;
string[,] fkA = new string[num,5];
for(int i=0;i<num;i++)
{
string[] b = a[i].Split(chrb);
string fkIndex = "";
for(int ii=0;ii<cols.Length;ii++)
{
if(cols[ii] == b[0])
{
fkIndex = ii.ToString();
fkA[i,0] = fkIndex;
}
}
for(int j=0;j<4;j++)
{
fkA[i,j+1] = b[j];
}
}
return fkA;
}
}
}
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com
面对“数字中国”建设和中国制造2025战略实施的机遇期,中车信息公司紧跟时代的步伐,以“集约化、专业化、标准化、精益化、一体化、平台化”为工作目标,大力推进信息服务、工业软件等核心产品及业务的发展。在慧都3D解决方案的实施下,清软英泰建成了多模型来源的综合轻量化显示平台、实现文件不失真的百倍压缩比、针对模型中的大模型文件,在展示平台上进行流畅展示,提升工作效率,优化了使用体验。
本站的模型资源均免费下载,登录后即可下载。模型仅供学习交流,勿做商业用途。
本站的模型资源均免费下载,登录后即可下载。模型仅供学习交流,勿做商业用途。
本站的模型资源均免费下载,登录后即可下载。模型仅供学习交流,勿做商业用途。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@evget.com
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
慧都科技 版权所有 Copyright 2003-
2025 渝ICP备12000582号-13 渝公网安备
50010702500608号