This is a migrated thread and some comments may be shown as answers.

RadDropDownButton Get selected Item

1 Answer 354 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Jonathan Hylton
Top achievements
Rank 1
Jonathan Hylton asked on 15 Feb 2011, 03:58 PM
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)
    Me.btn_SpecificGroup.Items.Add(tag)
Next

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

many thanks!

Jonathan

1 Answer, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 15 Feb 2011, 05:49 PM
Hello,

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()
        Me.RadDropDownButtonElement1.Items.Add(menuItem)
        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
Richard
Tags
RibbonBar
Asked by
Jonathan Hylton
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Share this question
or