Basic DataGrid Query

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



Company Developer Name Last Update Action
Ace.k2 AAAArrrr Mar. 11, 2010 Delete
DFSDAFASF Joey Catanzaro Mar. 10, 2010 Delete
Data Actives John Mellumberg Feb. 25, 2010 Delete
Data Demons111 hhh Joey Catanzaro wwwww Mar. 10, 2010 Delete
Delta Business Group, LLC James R O sieczonek gfddfg Mar. 6, 2010 Delete
Engineering Design Systems, Inc. Steve Finch Mar. 7, 2010 Delete
Enterprise Systems, Inc. Jerry Ott Mar. 4, 2010 Delete
Erwin Setiawan Erwinss Lopez Feb. 9, 2010 Delete
Figtree Software Abby Rosenstein Mar. 4, 2010 Delete
GMR Company Harvey Mushman Mar. 8, 2010 Delete
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.