Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Imports System.ComponentModel
Imports System.Web.UI
<ToolboxData("<{0}:reversableGrid runat=server></{0}:reversableGrid>")> Public Class reversableGrid
Inherits System.Web.UI.WebControls.DataGrid
Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
MyBase.Render(output)
End Sub
Public ReadOnly Property sortExpression() As String
Get
Dim output As String
output = sortField
If Not sortAscending Then
output &= " DESC"
End If
Return output
End Get
End Property
Public Property sortField() As String
Get
Dim o As Object = ViewState.Item("sortField")
Dim output As String
If o Is Nothing Then
output = String.Empty
Else
output = o.ToString()
End If
Return output
End Get
Set(ByVal Value As String)
If Value = sortField Then
sortAscending = Not sortAscending
End If
ViewState.Item("sortField") = Value
End Set
End Property
Private Property sortAscending() As Boolean
Get
Dim o As Object = ViewState.Item("sortAscending")
Dim output As String
If o Is Nothing Then
output = True
Else
output = CBool(o)
End If
Return output
End Get
Set(ByVal Value As Boolean)
ViewState.Item("sortAscending") = Value
End Set
End Property
End Class
<%@ Register TagPrefix="link9" Namespace="link9.customControls" Assembly="reversableGrid" %>
<link9:reversableGrid id="link9Grid" runat="server" AllowSorting="True" />
Protected WithEvents link9Grid As link9.customControls.reversableGrid
Protected Sub HandleSorting(ByVal sender As Object, ByVal e As DataGridSortCommandEventArgs) Handles link9Grid.SortCommand
'We're telling the grid what the user clicked here
link9Grid.sortField = e.sortExpression
bindGrid()
End Sub
private sub bindGrid()
link9Grid.datasource = returnDataView()
link9Grid.dataBind()
end sub
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
dim dv as new dataview(ds.tables(0).defaultView)
dv.sort = link9Grid.sortExpression
return dv
~ ~ ~ ~ ~ ~ ~ ~ ~ ~