Appendix A. How-To Questions

How do I supply my own images for control buttons?
Replace the files save.gif, cancel.gif, etc. with your own images and place them in a directory where AspGrid can find them. If necessary, use the ImagePath property.
How do I make my grid read-only?
Set the property Grid.ReadOnly to True, which is equivalent to setting the properties CanDelete, CanAppend and CanEdit to False.
How do I turn a field into a hyperlink?
Use the AttachExpression method of the Column object. For a code sample, see Chapter 7 of the manual.
How do I make a column sortable?
Set the CanSort property of the respective column object to True.
How do I limit the number of rows shown at a time?
Set the MaxRows property of the desired number of rows. Navigation buttons will appear automatically.
How do I make AspGrid use the POST method instead of GET?
Set the property Grid.MethodGet to False.
How do I show control buttons on both sides of a grid, or only on the left side?
Call the method Grid.ShowLeftSideButtons, or Grid.ShowLeftSideButtons False, respectively.
How do I perform client-side JavaScript validation?
Write a validation routine, then specify it via the Grid.FormOnSubmit property. See Chapter 6 for details.
How do I display a confirmation dialog on deletion?
Set the Grid.DeleteButtonOnClick property to a message you want to appear in the confirmation dialog. See Chapter 6 for details.
How do I perform server-side validation?
Examine submitted data via Request("FIELD2") and such. Call Grid.IgnoreCommands if validation fails. See Chapter 6 for details.
How do I show alternating row colors?
Set the properties Grid.Cols(...).Cell.BGColor and Grid.Cols(...).Cell.AltBGColor to the two colors of your choice.
How do I set colors for the control button areas?
The left control button column is accessible via Grid.Cols(0).Cell, the right column via Grid.Cols(999).Cell, the header via Grid.Cols(0 or 999).Header, and the footer via Grid.Cols(0 or 1 or 999).Footer.
How do I access values of a grid programmatically?
Call Grid.Display(False) instead of Grid.Display, then use the Grid.Output collection. See Chapter 8 for details.
How do I show all records in the edit mode at the same time?
Call Grid.BuildForm instead of Grid.Display, then use the Grid.Output collection. See Chapter 9 for details.
How do I build data-bound forms?
Construct your SQL SELECT statement to return a single-record recordset. Call Grid.BuildForm instead of Grid.Display, then use the components of the Grid.Output collection to display individual form items within your own HTML layout. See Chapter 10 for details.
How do I search for records?
Call Grid.Find with a search criteria, then call Grid.Display. Your grid will be displayed starting with the first record that met the specified criteria. See Chapter 11 for details.
How do I know when the component is going to expire?
Call Response.Write Grid.Expires. This property returns the component's expiration date, or 9/9/9999 if you are running a registered version.
How do I display the Add New button and a new record on the top of the grid rather than bottom?
Use the Display(False) approach described in Chapter 8, and make the sections "Display Body" and "Display Footer" in the first code sample switch places.
How do I display image tool tips (such as "Edit", "Save", etc) in a language other than English?
See article PS01041640 at the Persits Software support site.
How do I prevent a new record from being added when a user hits the Refresh button?
See article PS01043048 at the Persits Software support site.
How do I make an external parameter passed from another page or frame persistent within my grid-hosting page?
See article PS01060658 at the Persits Software support site.

COM+ Role-based Security