radtoolbardropdown commandname missing! How do I reference it?

2 posts, 0 answers
  1. Bexm
    Bexm avatar
    67 posts
    Member since:
    May 2007

    Posted 19 Jun 2008 Link to this post


    I have a rad tool bar with numerous buttons and two dropdowns... I need to dynamically add buttons to the buttons collection of the dropdowns..

    I know to get reference to it you need to get the toolbaritems collection and loop through them and find your dropdown..

    Here lies my problem.. The Radtoolbardropdown seems to be missing an ID property, or a commandname property.
    How do I know which drop down I am adding the buttons to?

    I don't want to use the text as this may change, so how do I do it?

    Thank Bex
  2. Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 23 Jun 2008 Link to this post

    Hello Bexm,

    The other way to access the dropdown button is to use its index in the RadToolBarItems collection.
    Consider the following example:

    protected void Page_Load(object sender, EventArgs e) 
        RadToolBarDropDown tbd = RadToolBar1.GetAllItems()[2] as RadToolBarDropDown; 
        tbd.Buttons.Add(new RadToolBarButton("added to first dropdonw")); 
        tbd = RadToolBar1.GetAllItems()[7] as RadToolBarDropDown; 
        tbd.Buttons.Add(new RadToolBarButton("added to second dropdonw")); 

    Kind regards,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top