Replies Back to Article

Complex Sorting and Paging ASP.Net and DWMX

sorting
December 17, 2003 by Paul Anderson
Excellent article....this has helped me with designing a search results page for my companies website.
Great tutorial !
December 17, 2003 by Marcellino Bommezijn

Charles,

Finally there is someone that can present a ASP.NET tutorial which gives me the 'push' to actually get started with moving to ASP.NET.

Hope you have some more of these tutorials in 'the magic head' covering ASP.NET in DWMX.

Thanks

 

 

Thanks - VB .NET examples?
April 1, 2005 by Liam Cassidy
Great article - thank you! I don't use (or know) C#... anyone able to post the VB .NET alternatives?
VB Version
May 12, 2005 by Stephen Davidson

Great article...i was able to follow it and convert it to VB .Net, if anyone wants the code for this drop me a line.

Cheers,

Stephen

RE: VB Version
May 23, 2005 by charlie stephens

I would greatly appreciate the Vb version of this datagrid sorting tutorial. I emailed you Stephen and I REALLY appreciate you And DMXZone!!!

 

Thanks,

Charlie stephens

Great way to sort
August 30, 2005 by ERP ERP

Thanks for the code, there is an alternative method that the folks at Dreamweaver put together using the query string, but this seems to be just as fast, and there is no special coding of the CommandText in the dataset.

For those looking for the VB Version of the code:

 '//////////////////////////////////
 'Created by: Charles Stratton
 'Copyright:2003
 'Description: DataGrid ASC/DESC sorting
            ' Notes: the sort expression on the datagrid should only contain the column name
            '         e.g sortexpression="EmployeeID"
 '        and not sortexpression="EmployeeID ASC"
 '////////////////////////////////////////////
 
 'Declare Global Variables
 Dim strSort As String
 Dim strASC As String
 
Private  Sub Sort_Grid(ByVal sender As Object, ByVal e As DataGridSortCommandEventArgs)
 strSort = dgEmployees.Attributes("SortExpression")
    strASC = dgEmployees.Attributes("SortASC")
 strSort = e.SortExpression
 dsGrid.DefaultView.Sort=strSort
 
 'Toggle the sort 
   If strASC ="no" Then
    strASC="yes"
   Else
    strASC="no"
   End If
 
 'Update the DataSet sort method and Attribute Carrier
  If strASC = "no" Then
   dsGrid.DefaultView.Sort +=" Desc"
   dgEmployees.Attributes("SortASC")="no"
  Else
  dsGrid.DefaultView.Sort+=" ASC"
  dgEmployees.Attributes("SortASC")="yes"
  End If
   'Update the DataGrid
   UpdateView()
End Sub
 
Private  Sub UpdateView()
 'Bind the updated DataGrid  
 dgEmployees.DataSource = dsGrid.DefaultView
 dgEmployees.DataBind()
End Sub

'----------------------------------------------------------------
' Converted from C# to VB .NET using CSharpToVBConverter(1.2).
' Developed by: Kamal Patel (http://www.KamalPatel.net)
'----------------------------------------------------------------

edit after sort
December 18, 2006 by Ted Matson

This works well, but after I sort, the edit button calls up the wrong row.  Any ideas?  Thanks!

Thanks!
March 12, 2007 by cherie reinheimer
Great Tutorial! don't for get the -script- tags for the vb code!
You can convert the VB.Net to C#
May 28, 2007 by david crook
If you want an industrial strength way to convert VB.Net to C# and the free converters just don't cut it, check out www.vbconversions.net.