Address Book Data Grid

The grid control is a spreadsheet-like object. The Address Book application uses it to display data returned from queries.

The following HTML code defines the grid control. Copy and paste this code just following the comment tag which refers to it.

<OBJECT CLASSID="clsid:AC05DC80-7DF1-11d0-839E-00A024A94B3A"
	CODEBASE="http://<%=Request.ServerVariables("SERVER_NAME")%>/MSADC/Samples/Sheridan.cab"
	ID=GRID1 
DATASRC=#SControl 
HEIGHT=125 
WIDTH=495>
	<PARAM NAME="AllowAddNew"   VALUE="TRUE">
	<PARAM NAME="AllowDelete"   VALUE="TRUE">
	<PARAM NAME="AllowUpdate"   VALUE="TRUE">
	<PARAM NAME="BackColor"     VALUE="-2147483643">
	<PARAM NAME="BackColorOdd"  VALUE="-2147483643">
	<PARAM NAME="ForeColorEven" VALUE="0">
</OBJECT>
<HR>

The OBJECT tag defines the grid control component to the program. The tag includes parameters that allow you to set the size of the grid, change the data displayed when information is updated or deleted, and dynamically change the number of rows according to the results of a query. The other parameters set the color properties of the grid control.

The following table describes the parameters associated with the OBJECT tag.

Parameter Description
CLASSID A unique, 128-bit number that identifies the type of embedded object to the system. This identifier is maintained in the local computer's Windows registry. It is specific to this Sheridan grid control.
CODEBASE Specifies the location of a source file of the object being called, if it is not on the client computer.

In this case, CODEBASE specifies the location of a .cab file containing the Sheridan ActiveXĂ– controls. The program uses Active Server Pages script (the code enclosed by the <% and %> signs) to request the server name part of the URL.

ID Defines a document-wide identifier for the embedded object.
DATASRC Identifies the data source that is used to bind the data grid to back-end data (in this case, SControl, which is an RDSIE3.DataControl object).
WIDTH and HEIGHT Identifies the dimensions of the control, in pixels.

For the Address Book application, the grid object uses several additional parameters to enable editing. Without these specifiers, the grid can only present a read-only, static view of theeditable data. The following table lists editing parameter settings for the grid control in this sample application.

Parameter Value Description
AllowAddNew TRUE Allows an existing data display to add new records.
AllowDelete TRUE Allows an existing data display to remove records.
AllowUpdate TRUE Allows changes to a cell in the grid.

The BackColor, BackColorEven, and BackColorOdd parameters set the grid to a white background with black text.