全編輯WebGrid控制項LrcGrid(5)—— 建構函式、變數和屬性

來源:互聯網
上載者:User
web|變數|函數|控制項 全編輯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



相關文章

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。