Full Edit WebGrid Control LrcGrid (3) - Overall Structure

xiaoxiao2021-03-06  43

Full Edit WebGrid Control LrcGrid (3) - Overall Structure

resource:

Lrcgrid uses two reference files: a CSS style table file myfsheet.css, a JS script library file Updarray_lrc.js.

The style table file applied to the text box is stored in the text box in different modes (browsing, editing, focus).

Hidden (Browse) Style:

.lrc_txt_hid {border-style: none; width: 95; Background: URL (images / txt_back.gif);}

2. Edit the style:

.lrc_txt_show {border-style: groove; Background-color: #ffffff; width: 95;

3. Focus style:

.lrc_txt_edit {border-width: medium; border-style: groove; font-weight: bolder; background-color: yellow; width: 95;

Script Base: Contains a function of the control client operation. include:

Switch the table to the edit mode: chGEDITROW (RowIndex, Tab) ()

Switch the table column to the edit mode: ChGedit (ColIndex, Tab)

SQL statement in the client constructor update the database: Buildsql (TabName)

Add new recorded functions: addrow (tab)

Remove the newly added line of function: Removerow (Tab):

The total code will be posted later if it is too long.

LrcGrid class structure:

Lrcgrid contains three classes and an enumeration

VirtualRecordcount Class: Record Paging Information PageChangeDeventargs Class: Inherited from Eventargs Converted Event Pagerstyle Enumeration: Sub-navigation strips Enumerate LrcGrid class: Inherited from System.Web.ui.WebControls.Table, implement the InamingContainer interface.

The first few is relatively simple, I put the code directly.

#Region VirtualRecordCount Class records the class of page information

Public Class VirtualRecordcount

{

Public int recordcount;

Public int pagecount;

Public int recordsinlastpage;

}

#ndregion

#REGON Pagerstyle Enum Paging Navigation Bar Form Enumeration

Public Enum Pagerstyle

{

Nextprev,

NumericPages

}

#ndregion

#REGON PageChangeDeventArgs Class Change Event Class

Public Class PageChangeDeventArgs: Eventargs

{

Public Int OldPageIndex;

Public int newpageindex;

}

#ndregion

The LrcGrid class is more complicated, 1000, the general structure is as follows (all source code will be posted in the following chapter!):

[

ToolboxData ("<{0}: lrcgrid runat = server> "),

DefaultProperty ("Selsql")

]

Public class lrcgrid: system.web.ui.webcontrols.table, inamingcontainer

{

Public lrcgrid (): base () {......}

#Region private variable

Private ......

#ndregion

#Region and paging related private variables

Private ......

#ndregion

#Region Public property

///

/// Foreign key indication

///

[

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;}

}

......

#ndregion

#Region and page-related public members

#ndregion

#Region public method reconstruction

///

/// Reconnect control

///

Public void rebuild () {...}

#ndregion

#REGON override process

Protected Override Void CreateChildControls ()

{this.rebuild ();

Protected Override Void OnPrender (Eventargs E) {...}

#ndregion

#Region Sort

Private void LK_COMMAND (Object Sender, CommandEventAndeventAndeventAndArgs E) {...

#ndregion

#Region Creating a title line

Private void Buildtitle () {...}

#ndregion

#region Create a data line

Private void buildcol () {......

#ndregion

#Region Creating actions

Private void buildoper () {......

#ndregion

#REGON initialization data set

Private void initdataset () {......

#ndregion

#REGON Judgment is the editorial column

Private Bool Iseditcol (INT I) {...}

#ndregion

#REGON Judgment is the foreign key

Private bool isfkcol (int II) {......}

#ndregion

#Region Return to the Exterior Drop List

Protected DropdownList fklist (int i, string soldage) {.....}

#ndregion

#Region Submit Data, Update Database

Private void lrcbtn_sub_click (Object Sender, Eventargs E) {...}

#ndregion

#Region Delete one

Private void Lkdelone_Command (Object Sender, CommandEventAndAndeventargs E) {...}

#ndregion

#Region all delete

Private void LKDEL_COMMAND (Object Sender, CommandEventAndAndeentargs E) {...}

#ndregion

#REGION constructor delete statement

Private string builddelsql (int index) {...}

#ndregion

#REGION update database

Private int execsql (String SQL) {......

#ndregion

#Region paging related operations

Private Void BuildnextPrevui (TableCell Cell) {......} Private Void BuildNumericPageSui (TableCell Cell)

Private Void BuildcurrentPage (Tablecell Cell)

......

#ndregion

}

Because time rush, implementation is the primary purpose, the code has not been optimized, the structure is not very good, there will be time to do it later!

转载请注明原文地址:https://www.9cbs.com/read-61237.html

New Post(0)