iASP_Grid Component: Grid Object

This is the main object returned by the Server.Create("iASP_Grid.Grid") command. Other objects supported by iASP_Grid are available through the Grid object.

Property Description
SQL = String  The main SQL select statement is specified, on which the grid is based.  The grid does not support SQL statements with the join CLAUSE and must be based on a table that contains an identity column.  This column must be the first one in the SELECT statement's field list.
FileName = String Specifies the file name of the ASP page in which the grid's object is created. This property should be set to correctly generate the ACTION attribute of <FORM> tags.

e.g.

Grid.FileName = "Sample1.asp"

FormName = String Specifies the NAME attribute of the <FORM> tags. This property is optional.
NumberOnPage = int This property must be set if there are multiple Grids on the same page.  Each grid must have a unique number assigned to it.  The default value  is 1.

e.g.

Grid2.NumberOnPage = 2

CanAppend = Boolean Specify whether the grid should display the Add New buttons.  If this property is set to False the Add button is not displayed. By default the value is True.
CanEdit = Boolean Specify whether the grid should display the Edit button.  If this property is set to False the Edit button is not displayed. By default the value is True.
CanDelete =Boolean Specify whether the grid should display the Delete button.  If this property is set to False the Delete button is not displayed. By default the value is True.
ShowHeader = Boolean Specifies whether the grid should show a header with column names.  If this property is set to False columns do not display a header.  By default the value is True.
UseImageButtons = Boolean Specifies whether the grid should use images for the edit, delete, add new, up, down, backward, forward, cancel, and ok buttons.  If set to False, the grid uses regular HTML submit buttons.  By default the value is True.
MaxRows = int Specifies the maximum amount of rows displayed by the grid at a time. If the amount of records in the current record set exceeds this value, the forward and backward arrow buttons will be displayed.
ImagePath = String Specifies the path to the images used for the edit (edit.gif), delete (delete.gif), add new (add.gif), up (up.gif), down (down.gif), forward (forward.gif), backward (backward.gif), cancel (cancel.gif), and ok (save.gif) buttons.

By default, the button images are located in the same directory as that of script file.  The path should be relative to the directory in which the script file is located.

e.g.

Grid.ImagePath = "/images/buttons/"

ExtraFormItems = String The specified String will appear as an additional HTML Form item in every Form generated by iASP_Grid.

e.g.

Grid.ExtraFormItems = "<INPUT TYPE=HIDDEN NAME=ID VALUE="& Request("ID") & ">"

SQLBeforeInsert = String The specified SQL statement will be executed before adding the record to the database.
SQLAfterInsert = String The specified SQL statement will be executed after adding the record to the database.
SQLBeforeUpdate = String The specified SQL statement will be executed before updating the edited record to the database.
SQLAfterUpdate = String The specified SQL statement will be executed after updating the edited record to the database.
SQLBeforeDelete = String The specified SQL statement will be executed before deleting the record from the database.
SQLAfterDelete = String The specified SQL statement will be executed after deleting the record from the database.
Method Description
Connect(String DRIVER,String DSN,string UserID, Password as String) Establishes a connection with a data source.  Throws an exception in case of an error.

Parameters:

DRIVER - The Driver is a String used to locate and access databases. The driver depends on the type of database being accessed. See Appendix B for examples of different drivers.

DSN - a System data source name.

UserID, Password - authentication parameters for the data source.

Disconnect() Terminates the connection to the data source established with the connect method.  Throws an exception in case of an error.
Display() Displays the grid when iASP_Grid is used in the table mode. Throws an exceptions in case of an error.
BuildForm() Displays the grid when iASP_Grid is used in the form mode.  Instead of displaying anything this method prepares HTML INPUT Tags for each column of the Grid.  These Input Tags can be displayed using FormHTML property of the Column Object.  Throws an exceptions in case of an error. See Sample 5 for a working example.
Table() Returns the Table object.
Cols(int Index) Returns the specified Column object.

Parameter:

Index - The index is 1-based.

e.g.

Grid.Cols(2).Color = "blue"

Sets the color of the second column of the Grid to blue.
 

ColRange(int FromIndex, Integer ToIndex) Returns a special ColumnRange object that represents a group of adjacent Column objects. The methods and properties of the ColumnRange Object are the same as the Column Object.

Parameters:

FromIndex - The starting column index.
ToIndex -  The column till which the properties are set.

e.g.

Grid.ColRange(2,4).Color = "red"

is the same as :

Grid.Cols(2).Color = "red"
Grid.Cols(3).Color = "red"
Grid.Cols(4).Color = "red"

ShowLeftSideButtons(boolean ShowBoth) Specifies whether the Grid will display control buttons on both sides.

Parameters:

if ShowBoth = true then control buttons are displayed on both sides

else the control buttons are only displayed on the left side of the Grid.

ShowLeftSideButtons( ) Specifies that the control buttons will be displayed on the left side of the Grid.

APPENDIX B

The following table contains a few examples of JDBC drivers for different databases available in the market. For a complete listing of JDBC drivers supported by iASP refer to the official iASP Documentation.
 
Driver Database
sun.jdbc.odbc.JdbcOdbcDriver Access(Win32) or SQL Server
COM.cloudscape.core.JDBCDriver Cloudscape 1.2(Win32 & Unix)
COM.cloudscape.core.JDBCDriver Cloudscape 1.5(Win32 & Unix)
oracle.jdbc.driver.OracleDriver Oracle(Win32 & Unix)
twz1.jdbc.mysql.jdbcMysqlDriver MySQL

NOTE: At the time this document was written, the twz1.jdbc.mysql.jdbcMysqlDriver drivers had a bug with AutoIncrement type fields. It is recommended that UniqueIndex column be used for mySQL databases.

If you require technical support please send complete details about the problem you are having to support@halcyonsoft.com.


Copyright © 1998-2002, Halcyon Software Inc. All rights reserved.