This is a duplicate of ex_paging.asp except it uses sort_clsDataGrid.asp which allows you to set column headers as "sort by" links. The .BoundColumn Method now takes 2 more arguments. True/False if the column is "sort by". And a string to specify a CSS class or an empty string for none. See code below for example. The sorting isn't in the other version because it doesn't work with stored procedures (unless you add a sort by param).
back to other examples
Code Used for following DataGrid:
---------------------------------
Set objDataGrid = New clsDataGrid
Set objDataGrid.Connection = objConn
objDataGrid.Command = strQuery
objDataGrid.PageResults = True
objDataGrid.PageSize = 10
objDataGrid.CurrentRecord = intBegRec
Call objDataGrid.SetTableOptions("100%", 2, 2, 0)
objDataGrid.GridClassName = "clsgrid"
objDataGrid.HeaderClassName = "clsheader"
objDataGrid.ItemClassName = "clsitem"
objDataGrid.AltItemClassName = "clsitemalt"
objDataGrid.FooterClassName = "clsfooter"
objDataGrid.PagingLinkClass = "clslink"
objDataGrid.AutoGenerateCols = False
Call objDataGrid.BoundColumn("testID", "Character ID", True, "clslink")
Call objDataGrid.BoundColumn("testCharacter", "Character Name", True, "clslink")
Call objDataGrid.BoundColumn("testFromWhat", "Book/Show", True, "clslink")
Call objDataGrid.BoundColumn("testDate", "Date Entered", True, "clslink")
objDataGrid.Bind()
Set objDataGrid = Nothing
Character ID | Character Name | Book/Show | Date Entered |
1 | John Galt | Atlas Shrugged | 08/10/2002 |
2 | Hank Reardon | Atlas Shrugged | 08/10/2002 |
3 | Eddie Willers | Atlas Shrugged | 08/10/2002 |
4 | Dagny Taggart | Atlas Shrugged | 08/10/2002 |
5 | Ragnar Danneskjold | Atlas Shrugged | 08/10/2002 |
6 | Francisco D'Anconia | Atlas Shrugged | 08/10/2002 |
7 | Midas Mulligan | Atlas Shrugged | 08/10/2002 |
8 | Jerry Seinfeld | Seinfeld | 08/10/2002 |
9 | George Costanza | Seinfeld | 08/10/2002 |
10 | Cosmo Kramer | Seinfeld | 08/10/2002 |
Next 10 » |