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

RibbonBarMenuItem Custom Data

3 Answers 93 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Kevin Main
Top achievements
Rank 1
Kevin Main asked on 07 Apr 2011, 03:49 PM
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       

3 Answers, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 07 Apr 2011, 05:18 PM
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
0
Kevin Main
Top achievements
Rank 1
answered on 08 Apr 2011, 09:18 AM
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
0
Nikolay Tsenkov
Telerik team
answered on 13 Apr 2011, 02:17 PM
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.

Tags
RibbonBar
Asked by
Kevin Main
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Kevin Main
Top achievements
Rank 1
Share this question
or