Imports System.Data.SqlClient
Imports System.Data
Imports Telerik.Web.UI

Partial Class _Default
    Inherits System.Web.UI.Page


    Public Function GetDataTable(ByVal query As String) As DataTable
        Dim ConnString As String = ConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString
        Dim conn As SqlConnection = New SqlConnection(ConnString)
        Dim adapter As SqlDataAdapter = New SqlDataAdapter
        adapter.SelectCommand = New SqlCommand(query, conn)
        Dim table1 As New DataTable
        conn.Open()
        Try
            adapter.Fill(table1)
        Finally
            conn.Close()
        End Try
        Return table1
    End Function

    Protected Sub RadGrid2_ItemCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid2.ItemCommand

        Select Case e.CommandName
            Case RadGrid.PerformInsertCommandName
                Try

                    Dim item As GridDataInsertItem = DirectCast(e.Item.OwnerTableView.GetInsertItem(), GridDataInsertItem)
                    If RadGrid2.MasterTableView.IsItemInserted Then
                        'c.CitaId = Request.QueryString("ic")
                        Dim ProductoId As String = DirectCast(item("GridDropDownColumn").Controls(0), RadComboBox).SelectedValue
                        If DirectCast(item("CustomerID").Controls(0), RadNumericTextBox).Value.HasValue Then
                            Dim Cantidad As String = DirectCast(item("CustomerID").Controls(0), RadNumericTextBox).Value
                        End If
                  
                    End If
                Catch ex As Exception

                End Try
        End Select



    End Sub

End Class
