RibbonButton

Represents a Button control in the SharePoint Server Ribbon.
SharePoint 2010 Ribbon Button

Inheritance Hierarchy


Assembly: QASPRibbon.dll
Namespace: QASPRibbon.Controls

Properties

Property Type Description
Id String A string that identifies the button, such as "RibbonControl". (Inherited from RibbonElement)
Alt String Alternative text for the button.
Title String A string value representing the button's label. (Inherited from RibbonElement)
TitleCss String The name of a CSS class selector to be applied to the control's label.
Description String A string that describes the button. The description is displayed only when the button is in a menu and is being rendered with the Menu32 display mode. (Inherited from RibbonElement)
Sequence Integer An integer that specifies the order of placement among sibling XML nodes. (Inherited from RibbonElement)
FullId String Control' Identifier that used to register it in the Ribbon. (Inherited from RibbonElement)
Visible Boolean A value that indicates whether a button control is rendered on the ribbon. (Inherited from RibbonControl)
Enabled Boolean A value that indicates whether a button control is enabled. (Inherited from RibbonVisualControl)
Image RibbonImageDefinition Image that is displayed in the button control. (Inherited from RibbonVisualControl)
ToolTip RibbonToolTip The tooltip of the button. (Inherited from RibbonVisualControl)
OnClientActivate String Client-side script that executes when a button is activated.
OnClientClick String Client-side script that executes when a button's Click event is raised.
OnClientStateCheck String Client-side script that executes before checking button is enabled or not.

Events

Event EventHander Description
OnAction RibbonButtonActionEventHandler Server-side event that cccurs when the Button control is clicked

Derived classes

Constructors

public RibbonButton()

public RibbonButton(string id)

public RibbonButton(string id, string title)

Example

The following example defines a button control with tooltip.
//ToolTip
var simpleButtonToolTip = new RibbonToolTip("ToolTip Title", "ToolTip Description");
//Button
var simpleButton = new RibbonButton("EditButton", "Edit")
                    {
                        Image = RibbonImageDefinition.Standard(3, 4),
                        OnClientClick = "console.log('EditButton has been pressed');",
                        ToolTip = simpleButtonToolTip,
                    };
simpleButton.OnAction += new RibbonButtonActionEventHandler(simpleButton_OnAction);


Method to handle button click event:
void simpleButton_OnAction(object sender, RibbonButtonActionEventArgs e)
{
    var currentButton = e.Instance;
    // Set a new title property
    currentButton.Title = "Clicked";
    // Set a new image property
    currentButton.Image = RibbonImageDefinition.Standard(2, 2);
}

And result is following:
SharePoint 2010 Ribbon Button

See also

Last edited Aug 25, 2013 at 5:30 PM by VitalyZhukov, version 15

Comments

No comments yet.