RibbonBarMenuItem Custom Data

4 posts, 0 answers
  1. Kevin Main
    Kevin Main avatar
    3 posts
    Member since:
    Nov 2009

    Posted 07 Apr 2011 Link to this post

    Hi all,

    Just wondering if there is a way to add some custom data (in this case an ID) against a RibbonBarMenuItem?

    Basically what I am doing is creating the menu from items in a database table - what I want to be able to do is grab the ID in the MenuItemClick event and then execute the correct code accordingly. 

    Obviously I could do a lookup on the text itself but this is not ideal and there could potentially be items with the same text so not really an option. I guess I could inherit from the RibbonBarMenuItem and create a custom control with an ID field - would this be the correct solution? or am I missing something obvious?

    Any help would be appreciated.

    Regards
    Kevin       
  2. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 07 Apr 2011 Link to this post

    Hi Kevin,

    Could you, please, try using the Attributes collection?
    Something like the following:
    //...
    var menuItem = new RibbonBarMenuItem();
     
    menuItem.Attributes["CustomAttribute"] = "CustomValue";
     
    //...
     
    if (item.Attributes["CustomAttribute"] != null && item.Attributes["CustomAttribute"] == someValue)
    {
    //...
    }
     
    //...

    Please, try this out and let me know the result.


    Regards,
    Nikolay Tsenkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kevin Main
    Kevin Main avatar
    3 posts
    Member since:
    Nov 2009

    Posted 08 Apr 2011 Link to this post

    Hi Nikolay,

    That sounds like a good way to do it except that the RibbonBarMenuItem doesn't seem to have an attributes collection exposed - I have only just downloaded the new release so I assume I have the latest version (2011.1.315.35)?

    I have managed to get round it at the moment by storing the ID in the ImageAltText field but obviously this is not ideal - any further suggestions?

    Thanks
    Kevin
  5. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 13 Apr 2011 Link to this post

    Hi Kevin,

    About the attributes collection:
     - I apologize about that. We have implemented an attributes collection already (you can upgrade to latest internal build in order to get the change), but it's not sent client-side (you can use it server-side, though).

    We already are planning on implementing such additional string property to some/all RibbonBarItems.


    Regards,
    Nikolay Tsenkov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top