Basic DataGrid Query

 Sample Home | Reset Form | Editable Grid Example
Enter a Company:



CompanyDeveloper NameLast Update
COnstruction data BUbure07/23/08 12:28pm
Construction Data Services James K. Fluffy07/16/08 12:15pm
Contanetica S.A. de C.V. Daniel Porras Allende22222207/07/08 09:43am
Cross Road Consulting, Inc Paul McCoyewfedasdf07/21/08 02:12am
Custom Softworks Test Marty Cantwell07/12/08 02:10pm
Cyberlogic Pty. Ltd. Chancelor05/27/08 11:23pm
DNG Solutions Darrell Gardnera06/12/08 06:55am
Dahlke-Datentechnik jhghkuhkuhe06/26/08 01:03pm
Data Active Chris Collins05/26/08 02:54am
Data Demons Joey Catanzaro06/30/08 01:14pm
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.