Basic DataGrid Query

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



Company Developer Name Last Update Action
Company Name Feb. 9, 2012 Delete
Compxxx Nameertet Nov. 30, 2011 Delete
Kuntz Lesher LLP Joe Nolllllll Feb. 9, 2012 Delete
L H Servicesdfdqsfdsff Smyther Feb. 9, 2012 Delete
Marty Glynn Associate Martin Glynnasdfasd Feb. 6, 2012 Delete
Neova inc. Dietmar Maier Dec. 10, 2011 Delete
Osborne Consulting, LLC Douglas Osborne Sep. 22, 2011 Delete
Paltiel Inc. Jayna Dec. 21, 2011 Delete
Peisch Custom Software, Inc. Barbara Peisch Feb. 9, 2012 Delete
Pek og Klikk AS Birger G. Thoresen Oct. 28, 2011 Delete
Pages: 1 2 3 4 5 6 7 8 9



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.