ASPxClientRibbon.SetItemValueByName(name, value) Method
Sets the value of the item with the specified name.
Declaration
SetItemValueByName(
name: string,
value: any
): void
Parameters
Name | Type | Description |
---|---|---|
name | string | A string value specifying the name of the item. |
value | any | An object that is the new item value. |
Remarks
The ribbon control’s client-side functionality allows items to be accessed programmatically on the client side. The SetItemValueByName method sets a value of an item specified by its name. An item’s name is defined by the RibbonTab.Name property.
The format of the value parameter depends on the processed ribbon item type. The table below lists the ribbon items with the values.
Editor Name | Server-Side Class | Value Format | Example |
---|---|---|---|
Button | - | - | |
Check Box |
| ribbon.SetItemValueByName(‘Save Copy’, true); | |
Color Button | The method supports the following color value formats.
| ribbon.SetItemValueByName(‘Highlight Color’, ‘red’); ribbon.SetItemValueByName(‘Highlight Color’, ‘#FFFF00’); ribbon.SetItemValueByName(‘Highlight Color’, ‘#FF0’); ribbon.SetItemValueByName(‘Highlight Color’, ‘rgb(255,255,0)’); | |
Combo Box | A string that is the item text or value | ribbon.SetItemValueByName(‘Font Family’, ‘Arial’); | |
Date Edit | A date object specifying the item value | ribbon.SetItemValueByName(‘date’, new Date (‘03/02/2011’)); | |
Drop-Down Button | - | - | |
Drop-Down Toggle Button |
| ribbon.SetItemValueByName(‘Nonprinting Characters’,true); | |
Drop-Down Gallery | Depends on the RibbonGalleryProperties.ValueType property | ribbon.SetItemValueByName(‘FontSize’, 23); | |
Gallery Bar | Depends on the RibbonGalleryBarItem.ValueType property | ribbon.SetItemValueByName(‘TextStyles’, ‘highlight’); | |
Option Button |
| ribbon.SetItemValueByName(‘Align Left’, true); | |
Spin Edit | A number specifying the item value | ribbon.SetItemValueByName(‘Font Size’, 14); | |
Template Item | - | - | |
Text Box | A string specifying the item value | ribbon.SetItemValueByName(‘UserName’, ‘Ann Devon’); | |
Toggle Button |
| ribbon.SetItemValueByName(‘Bold’, true); |
You can use the ASPxClientRibbon.GetItemValueByName method to get the value of an item with the specified name.