Data Grid

Change MouseOver Cursor from Arrow to Hand

This customization shows how to change the appearance of cursor when moving over cells in the DataGrid.
Table Name
Select a database table to be shown in DataGrid
Applies to
Page class
''' This method is called when DataGrid items databind.
''' Set the OnItemDataBound property of the datagrid to have a value of "MyItemDataBound"
''' This function is called everytime an item is bound to the datagrid
Public Sub MyItemDataBound(ByVal sender As Object, _
    ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) 
    If e.Item.ItemType = ListItemType.Item OrElse _
        e.Item.ItemType = ListItemType.AlternatingItem Then         
        Dim i As Integer = 0

        ' Apply new cursor style for all cells in the DataGrid.
        While i < (e.Item.Cells.Count) 
            ' Set the new cursor style.
            e.Item.Cells(i).Style("cursor") = "hand" 
        End While         
    End If     
End Sub

Applies to
Page class
''' Override the DataBind to populate the DataGrid. Call MyBase.DataBind()
''' and then populate the ASP DataGrid.
Public Overrides Sub DataBind()

    ' Call the MyBase.DataBind()
    If (Not Me.Page.IsPostBack) Then
        Dim myDataGrid As System.Web.UI.WebControls.DataGrid
        myDataGrid = CType(Me.FindControlRecursively("myDataGrid"), System.Web.UI.WebControls.DataGrid)
        ' If DataGrid is found then populate it.
        If (Not myDataGrid Is Nothing) Then
            Dim whereStr As String = Nothing

            ' Create orderBy clause
            Dim ob As BaseClasses.Data.OrderBy = Nothing

            ' Set page index and size
            Dim pageIndex As Integer = 0
            Dim pageSize As Integer = 1000

          ' Set the DataSource of the DataGrid
            myDataGrid.DataSource = ${${Table Name}ClassName}.GetDataTable(whereStr, ob, pageIndex, pageSize)                       
        End If
    End If    
End Sub


Terms of Service Privacy Statement