RadDropDownButton Get selected Item

2 posts, 1 answers
  1. Jonathan Hylton
    Jonathan Hylton avatar
    20 posts
    Member since:
    Sep 2009

    Posted 15 Feb 2011 Link to this post

    Hi There,

    I am using Rad Ribbon bar and have a dropdownbutton that I am dynamically creating the items for from a dataset. My problem is I can not seem to create an event handler for the selection as it appears that item.click does not seem to exist. here is my code:

    For Each row As DataRow In ds_sn.Tables("sn_tbl_groups").Rows
        Dim tag As New radmenuitem(row(1).ToString)
        tag.CheckOnClick = New EventHandler(AddressOf GroupMenuclick)

    can some one point me to what event i should see in order to create the handler for this?

    many thanks!

  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 15 Feb 2011 Link to this post


    Here's an exmaple. For each of the items in your recordset, create a new RadMenuItem and add it to your drop down button. Add a Handler manually for the item's click event

    Private Sub RadRibbonForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For i As Integer = 0 To 3
            Dim menuItem As New RadMenuItem()
            menuItem.Text = "Item #" & i.ToString()
            AddHandler menuItem.Click, AddressOf MenuItem_Click
        Next i
    End Sub
    Private Sub MenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim menuItem As RadMenuItem = CType(sender, RadMenuItem)
        MessageBox.Show("You clicked " & menuItem.Text)
    End Sub

    Hope that helps
Back to Top