Basic DataGrid Query

Enter a Company:



CompanyDeveloper NameLast Update
Construction Data Services blabla11/17/08 10:01pm
Contanetica S.A. de C.V. |1209/25/08 03:17pm
Cross Road Consulting, Inc TET11/13/08 07:04am
Custom Softworks Test Marty Cantwell10/30/08 11:38am
Cyberlogic Pty. Ltd. Chancelor11/07/08 05:07am
DNG Solutions Darrell Gardnera10/22/08 12:56am
Dahlke-Datentechnik jhghkuhkuhe11/05/08 12:30pm
Data Actives Chris Collins09/18/08 03:50pm
Data Demons Joey Catanzaro10/07/08 12:34am
Delta Business Group, LLC James R Osieczonek11/13/08 11:27pm
Pages: 1 2 3 4 5 6 7 8



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.