iASP_Grid Component: Column Object

The Column Object represents a specific column in the Grid. It is through this object that you set various properties of individual columns including size, color, font, default value, list of options (if applicable), etc.

Properties Description
Header Returns this column's Header object. This property is read-only.
Cell Returns this column's Cell object. This property is read-only.
Index Returns the 1-based index of this column.
Caption = String Sets the caption that will be displayed for the specific Column.  By default the name specified in the SQL statement is displayed as the column's caption.
Hidden = Boolean Setting this property to True, hides the specific column.  By default the value is False i.e. all columns are displayed.
ReadOnly = Boolean Setting this property to True causes the specified column to be rendered Non-Editable.  By default the property is set to False.
CanSort = Boolean Setting this property to True causes "arrow up" and "arrow down" buttons to be displayed in the header of this column.  By default this property is set to False.  By clicking the "arrow up" button the records are displayed in ascending order of the values in that column.  By Clicking the "arrow down" button, the records are displayed in the descending order of the values in that column..

NOTE: Setting this property to True for a column will discard any ORDER BY clauses specified for that column in the SQL statement.

DefaultValue = Object When this property is set for hidden, read-only, and blank columns, the specified value will be stored in the database.
Array = Variant  Array Setting this property causes a drop-down list box to be displayed for the specific column whenever the Grid is in Edit or Add mode. The list box will display the values specified in the Variant Array.

NOTE: VArray property must be set for proper functionality.

VArray = Variant  Array This method gives correct functionality only with Array
property set. The values specified in the Variant Array of the Array property, are displayed in the list box whereas, the corresponding values specified in Variant Array of the VArray property are stored in the database.

e.g. :

Grid.Cols(2).Array =Array("Single", "Married", "Divorced")
Grid.Cols(2).VArray = Array(1, 2, 3)

In the above example the values displayed in the list box are Single, Married and Divorced.  Whenever the user selects Single the value stored in the database would be 1, 2 for Married, and 3 for Divorced.

FormHTML Returns an HTML input tag if BuildForm method of the main Grid object has been called, otherwise an empty String is returned. See Sample 5 for a working example.
FieldName = String On setting this property, iASP_Grid will use the specified fieldname to perform all operations such as ORDER BY clause, on the database. 
Method Description
FormatNumeric(int decimals, Boolean ShowCommas) Use this method to format numeric data displayed in a column according to the specified parameters.

Parameters:

Decimals - the number of accepted decimal places in the number.
ShowCommas -  If the parameter is set to False commas are not displayed in the number. By default the value is set to True.

e.g.

Grid.Cols(5).FormatNumeric 2, True 

NOTE: The numeric data will be stored in the data base without commas.

FormatNumeric(int decimals) Use this method to format numeric data displayed in a column according to the specified parameters.

Parameters:

Decimals - the number of accepted decimal places in the number.

e.g.

Grid.Cols(5).FormatNumeric 2, True 

NOTE: The numeric data will be stored in the data base without commas.

AttachForeignTable(String SQL, int KeyColumn , int DisplayColumn) This method displays a drop-down list box in the column whenever that grid is in the Edit/Add mode. The values displayed in the list box are retrieved from a foreign table. 

Parameters:

SQL - the SQL statement that obtains the list of values from a foreign table.
KeyColumn - the 1-based index of the field in the SQL statement that will be stored in the database.
DisplayColumn - the 1-based index of the field in that SQL statement that will be displayed in the drop-down list box.

e.g.:

  Grid.Cols(3).AttachForeignTable "select Name, PhoneNumber from items", 1, 2

Names are displayed in the list box whereas the telephone numbers are saved in the table.

Grid.Cols(4).AttachForeignTable "select employee_name from Employee", 1, 1

Employee names are displayed and stored in the table.

AttachCheckBox(String DisplayChecked , String DisplayUnchecked) This method causes a check box to be displayed in the column in the Edit/Add mode. This method is used for fields that only store a non-zero value (true) and a zero (false).

In the non- Edit/Add mode, the specified String values (DisplayChecked/DisplayUnChecked) are displayed in the column.

Parameters:

DisplayChecked - The specified String is displayed in the column when the Grid is in the non- Edit/Add mode and the corresponding value in the database is non-zero.

DisplayUnchecked - The specified String is displayed in the column when the Grid is in the non- Edit/Add mode and the corresponding value in the database is zero.

e.g.:

  Grid.Cols(6).AttachCheckBox "Married", "Single"

AttachTextArea(String Rows, String Cols) This method causes a text Area to be displayed in the column in the Edit/Add mode. 

Parameters:

Rows - the ROWS attribute of the <TEXTAREA> tag.

Cols - the COLS attributes of the <TEXTAREA> tag.

e.g.:

Grid.Cols(6).AttachTextArea 5, 30

AttachTextArea( ) This method causes a text Area to be displayed in the column in the Edit/Add mode. 

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.