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

radtoolbardropdown commandname missing! How do I reference it?

1 Answer 104 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Bexm
Top achievements
Rank 1
Bexm asked on 19 Jun 2008, 09:38 AM
Hello

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

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 23 Jun 2008, 11:30 AM
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,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ToolBar
Asked by
Bexm
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or