This sample demonstrates grid databinding to a cursor. It uses explicit column binding and creation
and demonstrates how easy it is to provide paginated displays, how to hook up hyper links, and custom formatted
columns. Pagination is as easy as setting the PageSize property. Sorting is as easy as marking a column as sortable
and optionally providing a SortExpression (like UPPER(Company)).
The Company column demonstrates hyperlinking via the HREF() function. Rather than using fields directly you
can use expressions - any FoxPro UDF, class method or expression can be the expression. Here I use HREF() which
takes 2 parameters: A Url to navigate to which is marked up with an ID and the company name which is a straight
field.
The Last Updated column demonstrates a custom header, and custom header formatting via HeaderText (Last Updated) and
HeaderAttributeString (align='center'). It also uses a custom Format Expression that calls a method on the page.
This method is now fired for each iteration over the datasource cursor. Format expressions receive a single value which
is the result of the expression and the function must return a string result. In this case the function keys
of the checkbox of the form and if the date is within a year it modifies the columns style format to display
the column in red text with a white background. The possibilities are endless. You can control column formatting
for the header, the item and as this example demonstrates on a per column basis.