Share via


SPPageStateControl.PopulateCommandHandlers method

Sets the command handlers that handle the actions that the user selects by clicking the Ribbon buttons.

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Protected Overridable Sub PopulateCommandHandlers
'Usage

Me.PopulateCommandHandlers()
protected virtual void PopulateCommandHandlers()

Remarks

You can override this method and create your own command handlers. To do this, you should call the base class implementation first, and then set the command handler you want to override. Each command handler has a corresponding TransitionCommandHandlers enumeration value.

To override the command handler for a specific operation, set the command handler in the commandHandlers array for the corresponding enumeration value to your custom command handler.

For example, to customize what happens when someone clicks the Check In button, you override the PopulateCommandHandlers method and use code similar to the following to set the check in operation to your custom command handler.

this.commandHandlers[(int) TransitionCommandHandler.Checkin] = 
    new MyCheckinHandler(this);

Note

This code assumes that the constructor for your custom command handler takes the current page state control as parameter. This allows your custom command handler to leverage the built-in error handling functions.

See also

Reference

SPPageStateControl class

SPPageStateControl members

Microsoft.SharePoint.WebControls namespace