Skip to main content

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

RibbonButtonItem

-

-

Check Box

RibbonCheckBoxItem

true to check the item; otherwise false

ribbon.SetItemValueByName(‘Save Copy’, true);

Color Button

RibbonColorButtonItem

The method supports the following color value formats.

  • HTML color name;
  • Longhand hexadecimal notation;
  • Shorthand hexadecimal notation;
  • RGB format;

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

RibbonComboBoxItem

A string that is the item text or value

ribbon.SetItemValueByName(‘Font Family’, ‘Arial’);

Date Edit

RibbonDateEditItem

A date object specifying the item value

ribbon.SetItemValueByName(‘date’, new Date (‘03/02/2011’));

Drop-Down Button

RibbonDropDownButtonItem

-

-

Drop-Down Toggle Button

RibbonDropDownToggleButtonItem

true to check the item; otherwise false

ribbon.SetItemValueByName(‘Nonprinting Characters’,true);

Drop-Down Gallery

RibbonGalleryDropDownItem

Depends on the RibbonGalleryProperties.ValueType property

ribbon.SetItemValueByName(‘FontSize’, 23);

Gallery Bar

RibbonGalleryBarItem

Depends on the RibbonGalleryBarItem.ValueType property

ribbon.SetItemValueByName(‘TextStyles’, ‘highlight’);

Option Button

RibbonOptionButtonItem

true to check the item; otherwise false

ribbon.SetItemValueByName(‘Align Left’, true);

Spin Edit

RibbonSpinEditItem

A number specifying the item value

ribbon.SetItemValueByName(‘Font Size’, 14);

Template Item

RibbonTemplateItem

-

-

Text Box

RibbonTextBoxItem

A string specifying the item value

ribbon.SetItemValueByName(‘UserName’, ‘Ann Devon’);

Toggle Button

RibbonToggleButtonItem

true to check the item; otherwise false

ribbon.SetItemValueByName(‘Bold’, true);

You can use the ASPxClientRibbon.GetItemValueByName method to get the value of an item with the specified name.

See Also