Adding buttons dynamically to a RadToolBar

2 posts, 0 answers
  1. Tim
    Tim avatar
    57 posts
    Member since:
    Apr 2011

    Posted 07 Jul 2011 Link to this post

    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

     

  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 08 Jul 2011 Link to this post

    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!

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top