Imports System.Data.SqlClient
Imports System.Data

Partial Class DefaultVB
    Inherits System.Web.UI.Page


    Protected Sub RadGrid1_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand

        If (e.CommandName = "Details") Then

            'some code for redirect

        ElseIf (e.CommandName = "Delete") Then

            'delete selected value for example

        End If

    End Sub
    Public Function GetDataTable(ByVal query As String) As DataTable
        Dim ConnString As [String] = ConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString
        Dim conn As New SqlConnection(ConnString)
        Dim adapter As New SqlDataAdapter()
        adapter.SelectCommand = New SqlCommand(query, conn)

        Dim myDataTable As New DataTable()

        conn.Open()
        Try
            adapter.Fill(myDataTable)
        Finally
            conn.Close()
        End Try

        Return myDataTable
    End Function

    Protected Sub RadGrid1_OnNeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
        RadGrid1.DataSource = GetDataTable("SELECT Address FROM Customers")
    End Sub

End Class
