Using Zi Island Grid Control in ASP

zhaozj2021-02-16  31

Using Zi Island Grid Control in ASP

Zhi island mesh control as a representation of the data, which can be very convenient for currency style, renminbi case, Chinese big lowercase, various logic patterns, percentages styles, thousand-point division, etc., can freeze, lock the ranks, Enter data to verify; set formulas for fields, convenient and fast statistics, summarize data. Tag Island Grid Controls have won unanimous praise from software developers with its rich and varied operations. Below and you share the application experience of Zi Island Grid Controls in ASP: Figure 1 Style Setting Figure 2 Picture Management Figure 3 Multi-layer Title Figure 4 Summary Mode Figure 5 Freezing Lock Figure 6 Merge Mode 1, Register Zhi Island Grid Control

After downloading the Zhi Shi Grid Control (its file name is OGRID.OCX), register the control as follows: Click "Start" → "Run"; enter the following command in the Run dialog: Regsvr32 Register Zi Island Grid Control Control Regsvr32 / u Release of Pi Island Grid Control

Second, add a hi island grid control in the page

Add the following code to the page, you can insert the Zi Island Grid Control: where: Width and Height: Refers to the display width and height of the control; ID: Refers to the name of the control object, implements the name The operation of the control; CodeBase: Refers to the 刂 刂? Lt; /p> / p> of the installation of the control when the client is not installed, the page is not installed.

Third, use the Zhi Island Grid Control Perform XML Format Data

1. XML Document Format The Zi Island Grid Control uses XML documents as a data storage switch format, below is an XML document format:

Personnel Table Name FieldName> 10 < CELLTYPE> 0 .. . Zhang 3 male ... ... 2. Code implementation notifies the 智 岛 网格 control through the following statement to open the XML document: OGrid.OpenTableXML (")] The XML document in quotation marks Path, for example: http://www.oapro.com/ostarocx/sample/ogrid/xml/ style settings .xml or C: / style settings .xml four, use the Zi Island Grid control to represent data from the database

1. XML Document Format Tim Island Grid Control uses XML documents as a swap format, but more data sources are databases, how to behave from database data? We can turn the database's data to an XML format. The following code implements converts the contents of the data table in an Access database to an XML document format. You can replace the db.mdb file in your own database name. The specified data table name comes from the parameter value passed to the file: table_name.

<% Dim sql, rsdim Table_name <-! Obtain the data table name -> Table_name = request.QueryString ( "Table_name") Set rs = Server.CreateObject ( "ADODB.Recordset") Const adSchemaTables = 20adSchemaColumns = 4strConn = "DBQ = " server.mappath (" db.mdb ") "; defaultdir =; driver = {Microsoft Access Driver (* .mdb)}; "set oponn = server.createObject (" adodb.connection "Oconn.open strconnset rstSchema = oConn.OpenSchema (adSchemaColumns) Set rsttable = oConn.OpenSchema (adSchemaTables) i = 0%>

<% = Table_name %> <% // generate the XML header file Do Until rstSchema.EOFif rstSchema ( "Table_name") = Table_name thenif rstschema ( "column_Name") <> "ORowInfo" or rstschema ( "column_Name") < > "OSYSMACHINEID" THEN> <% = RSTSChema ("Column_name")%> <% = RSTSCHEMA ("Column_name")%> <% SELECT CASE Rstschema ("DATA_TYPE") Case "130" if Rstschema ("Character_Maximum_length") = 1073741823 Then%> 12 0 <% else%> 10 0 <% end ifcase 135%> 23 3 <% Case 3%> 7 0 <% Case 11%> 3 2 <% Case 131%> 10 <

/ DataType> 0 <% Case 5%> 7 0 <% Case Else%> 10 0 <% end select%> <% end ifend ifrschema.movenextloop%> // Generate XML file body <% sql = "select * from" & Table_namers.open SQL, STRCONN, 1, 1DO While Not Rs.eof%> <% fork = 0 to rs.fields.count-1if RS (k) .Name <> "OROWINFO" OR RS (K) .name <> "OSYSMACHINEID" THEN> <<% = rs (k) .Name% >> <% = rs (k)%> > <% end ifnext %> <% rs.movenextLooprs.close%> 2. Code implementation notifies Toml Document with the following statement: OGrid.SetTableXML (OGrid.httpget " : //www.oapro.com/mdb2xml.asp "," Table_Name = <% = Table_Name%> "))) The method httpget has two parameters, the first parameter to convert the XML format for the implementation database described above. Address, be sure to format, the relative or absolute path (because the method is not yet supported), the second parameter is the parameter passed to the file, where we passed the data table name: Table_name. V. Save the modification of the data

In the grid control, you can add, delete records, and modify the record content, how to save these modifications to the data source? Ten Island Grid Control provides three events: 1. Add record: EventsqlinsertRecord (StrtableName, Strsql) 2. Delete record: EventSqldeleteRecord (StrtAblename, strsql) 3. Modify record: EventsqlupdateRecord (StrtableName, strsql): StrtableName is a data table name that generates an event; strsql is the SQL statement of the executive event. These two parameters are provided to us by Zi Island Grid control for us to call. We can trigger events through scripts, the following is an example code: