You can easily customize your Ribbon menu control in Sharepoint 2010. This example demonstrate the custom CommandAction ribbon button which display the application page as model dialog.  Find the below Elements.xml sample used javascript file to execute the custom action Aboutscript().

<Elements xmlns=”http://schemas.microsoft.com/sharepoint/” >
<CustomAction
Id=”AboutFilesButton”
Location=”CommandUI.Ribbon”
RegistrationId=”101″
RegistrationType=”List”
Title=”About”>
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location=”Ribbon.Library.ViewFormat.Controls._children”>
<Button Id=”Ribbon.Library.ViewFormat.About”
Command=”AboutButtonCommand”
LabelText=”About”
Image32by32=”/_layouts/1033/IMAGES/AboutIcon.jpg”
TemplateAlias=”o1″ />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command=”AboutButtonCommand”
CommandAction=”javascript:Aboutscript();“/>  –> Refer Your Function here
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>

//Referencing the Script
<CustomAction
Id=”AboutFilesButton.Script”
Location=”ScriptLink”
ScriptSrc =”/_layouts/RibbonScripts/AboutButtonscript.js”/>
</Elements>

Similar Topics: