web| Variable | function | Control full edit WebGrid control Lrcgrid (5)--constructors, variables, and properties
Lrcgrid inherits from System.Web.UI.WebControls.Table, implements INamingContainer interface
Metadata properties and constructors: metadata declares the label and default property of a control, and the constructor specifies a default value for some properties of the control.
[
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;
}
......
To declare a private variable:
Private variables related to paging
#region and paging-related private variables
// ***********************************************************************
private string currentpagetext = "<b> </b> {0} <b> page, total </b> {1}<b> page </b>";
private string Nopageselectedtext = "No Selection page."
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
Private variables related to properties:
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;
Control properties, which are commented on, are no longer described in detail:
<summary>
FOREIGN key indication
</summary>
[
Category ("Key"),
Description (foreign key). Format: This table column name | foreign key Column name | Foreign key column name to display | Foreign key table name,..... ")
]
public string Fkcol
{
Get{return _fkcol;}
Set{_fkcol = value;}
}
<summary>
Whether to display the delete feature
</summary>
[
Category ("Key"),
Description ("show Delete feature")
]
public bool Isdel
{
Get{return _isdel;}
Set{_isdel = value;}
}
<summary>
Whether to show add functionality
</summary>
[
Category ("Key"),
Description ("Show add Feature")
]
public bool Isadd
{
Get{return _isadd;}
Set{_isadd = value;}
}
<summary>
Public properties: Displaying column names
</summary>
[
Category ("Key"),
Description ("Show Column Name")
]
public string COLSSTRCN
{
Get{return _COLSSTRCN;}
SET{_COLSSTRCN = value;}
}
<summary>
Table name of the primary table
</summary>
[
Category ("Key"),
Description (table name of primary table)
]
public string TABN
{
Get{return TABN;}
SET{TABN = value;}
}
<summary>
List of column names for the primary table
</summary>
[
Category ("Key"),
Description ("List of column names for primary tables")
]
public string Colsstr
{
Get{return _colsstr;}
Set{_colsstr = value;}
}
<summary>
Whether to jump focus with enter key
</summary>
[
Category ("Key"),
Description ("Jump focus with enter key")
]
public bool Istabchg
{
Get{return _istabchg;}
Set{_istabchg = value;}
}
<summary>
Select the SQL statement. Note that column names cannot be used ' * '
</summary>
[
Category ("Key"),
Description ("Select SQL statement.") Note that column names cannot be "*")
]
public string Selsql
{
Get{return (String) viewstate["Lrcselsql"];
set{viewstate["Lrcselsql"] = value;}
}
<summary