Imports Telerik.Web.UI

Partial Class UpdateControlWithAJAXDependingOnClickedToolbarButtonVB_WebUI
    Inherits System.Web.UI.Page

    Private updateControlID As [String]

    Protected Sub RadToolbar1_OnClick(ByVal sender As Object, ByVal e As RadToolBarEventArgs) Handles RadToolbar1.ButtonClick
        Dim button As RadToolBarButton = CType(e.Item, RadToolBarButton)
        Select Case button.CommandName
            Case "New"
                ListBox1.Items.Add(New ListItem((ListBox1.Items.Count + 1).ToString()))
                updateControlID = "ListBox1"
                Exit Select
            Case "Save"
                Dim i As Integer
                For i = CheckBoxList1.Items.Count To ListBox1.Items.Count - 1
                    CheckBoxList1.Items.Add(New ListItem((i + 1).ToString()))
                Next i
                updateControlID = "CheckBoxList1"
                Exit Select
        End Select
    End Sub
End Class