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

Adding buttons dynamically to a RadToolBar

1 Answer 169 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 07 Jul 2011, 12:56 PM
Hi

I am attempting to add RadToolBarbuttons to a RadToolBar I have defined in my aspx file.

I am adding the elements successfully after creating them with the following server side code.

 

 


RadToolBarButton
rtb = new RadToolBarButton();

 

rtb.Group = sGroup;

rtb.CheckOnClick =

 

true;

 

rtb.Checked =

 

false;

 

rtb.PostBack =

 

true;

 

rtb.ImageUrl = sImageUrl;

rtb.Value = sValue;

rtb.ToolTip = sToolTip;

I add the rtb object, actually more than one, to my RadToolBar.

 


They all appear correctly in my UI.

However as soon as I mouse over them I get an exception.

I noticed the rendered html is different from an in-line RadToolBarButton.

The dynamically created buttons don't have _item["object Object"] or _itemTypeName["Telerik.Web.UI.RadToolBarButton"] attributes.

What am I missing?

TIA

 

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 08 Jul 2011, 05:30 PM
Hi Tim,

The problem you are experiencing is due to the fact that you are adding one and the same instance of the RadToolBarButton class.

If you want to have multiple buttons then you should create multiple instances and add them to the RadToolBar.

Please refer to the following help article giving information how to work with RadToolBar's items on the server-side.

All the best,
Dimitar Terziev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
ToolBar
Asked by
Tim
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or