Adding Custom Attributes to Menu from server and accesing from clientside

This post has 5 replies

Top 500 Contributor
Posts: 22
subodhpatil Posted: Wed Sep 5, 2007 @ 2:16 AM
I am using toolbar in which I am using one menu. The menu contol is populated from server side.
I am adding some custom attributes to menu as

Menu.Attributes.Add("CanRaiseSave", "false");

How can I access the same ata client side.
I want to acces it in the Menu_onItemSelect event.
Then I want to change the value and want acces the changed value on server in Menu_ItemSelected event.
Subodh Patil
Top 25 Contributor
Posts: 336
sadat Posted: Wed Sep 5, 2007 @ 12:04 PM
You can access the property on the client-side like this,
<code>
var canRaiseSave = MenuItem.getProperty("CanRaiseSave");
</code>
And you can set it like this,
<code>
MenuItem.setProperty("CanRaiseSave", true);
</code>
Top 500 Contributor
Posts: 22
subodhpatil Posted: Thu Sep 6, 2007 @ 4:07 AM
I don`t want to a menu item i want to menu itself.
Subodh Patil
Top 10 Contributor
Posts: 1,736
Chris Posted: Tue Sep 11, 2007 @ 4:33 PM
I'm afraid you can't do this.

Your easiest bet would be to make a hidden node...with the text CanRaiseSave and use the value field you want to check for.

Cheers,
Christopher Moncayo,
Solutions Architect
ComponentArt Inc.
Not Ranked
Posts: 4
shridutta Posted: Tue Aug 10, 2010 @ 9:43 AM
I had similar issue with tree node (menuItem)

user on server 

MenuItem.Attributes.Add("Message", "Hello there!!!");

On Client side use this 

eventArgs.get_item().getProperty('Message') 

Hope this helps. 
Top 10 Contributor
Posts: 1,736
Chris Posted: Fri Aug 13, 2010 @ 7:52 AM

Similarly,

 

You can do this to make it able to be used everywhere:

 

Code Behind:

MenuItem.ID = "Message";
MenuItem.Value = "Hello There!";

Javascript:

 

Call this when you want to show the message

var message = Menu1.findNodeById('Message').get_value();
alert(message);

 

Cheers,

Christopher Moncayo,
Solutions Architect
ComponentArt Inc.
Page 1 of 1 (6 items)