Imports System.Data
Imports Telerik.Web.UI

Partial Class DefaultVB
    Inherits System.Web.UI.Page
    Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs)
        Dim table As New DataTable()
        table.Columns.Add("ID")
        table.Columns.Add("Item")
        Dim i As Integer = 1
        While i <= 5
            Dim row As DataRow = table.NewRow()
            row("ID") = i
            row("Item") = "Item" + i.ToString()
            table.Rows.Add(row)
            System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
        End While
        RadGrid1.DataSource = table
    End Sub
    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
        Dim ddl1 As DropDownList = TryCast(sender, DropDownList)
        Dim item As GridDataItem = TryCast(ddl1.Parent.Parent, GridDataItem)
        Dim ddl2 As DropDownList = TryCast(item.FindControl("DropDownList2"), DropDownList)
        ddl2.DataSource = New Object() {ddl1.SelectedValue}
        ddl2.DataBind()
    End Sub

End Class
