
Imports System
Imports System.Data
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Telerik.WebControls

Partial Public Class DefaultVB
    Inherits Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    End Sub 'Page_Load


    Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.WebControls.GridItemEventArgs)
        If TypeOf e.Item Is GridDataItem Then
            Dim editLink As HyperLink = e.Item.FindControl("EditLink")
            editLink.Attributes("href") = "#"
            editLink.Attributes("onclick") = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("EmployeeID"), e.Item.ItemIndex)
        End If
    End Sub 'RadGrid1_ItemCreated


    Protected Overrides Sub RaisePostBackEvent(ByVal sourceControl As IPostBackEventHandler, ByVal eventArgument As String)
        MyBase.RaisePostBackEvent(sourceControl, eventArgument)

        If TypeOf sourceControl Is RadGrid Then
            Select Case eventArgument
                Case "Rebind"
                    RadGrid1.MasterTableView.SortExpressions.Clear()
                    RadGrid1.MasterTableView.GroupByExpressions.Clear()
                    RadGrid1.Rebind()
                Case "RebindAndNavigate"
                    RadGrid1.MasterTableView.SortExpressions.Clear()
                    RadGrid1.MasterTableView.GroupByExpressions.Clear()
                    RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1
                    RadGrid1.Rebind()
            End Select
        End If
    End Sub 'RaisePostBackEvent
End Class 'DefaultVB
