I have a webpart with custom setting.
I add 2 property to webpart setting. I want add button to Page tab ribbon when webpart added to page and value set for the property.
It is possible that add a button to Page tab ribbon?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityYou can create a Ribbon Tab which shows up when your web part is selected, this is what is called a Contextual Tab.
MSDN has an article: Walkthrough: Creating a Custom Web Part with a Contextual Tab
It's a lot of work, but as Wictor Wilén writes in CKSDev version 2.0 is released - includes Contextual Web Part SPI it's been made a lot easier by CKSDev
From your question, I understand that you want to add the button to the Page Tab in the Ribbon whenever a particular WebPart is added to the page.
You can do this with the JavaScript Client Object Model: http://msdn.microsoft.com/en-us/library/hh185004
Here is a list of all Locations where the Button can be added: http://msdn.microsoft.com/en-us/library/bb802730
If you want to go the Server Side way, you can add the Ribbon button like this: http://sp365.co.uk/2011/09/programmatically-add-ribbon-custom-action-to-an-existing-list/
Also, I would like to mention that there is an awesome Library on Codeplex for adding ribbon buttons: http://spribbon.codeplex.com/
Enabledscript
property of your ribbon element you can check if your web part is on the page you can enable the ribbon button.A starting point can behttp://www.thorntontechnical.com/tech/sharepoint/sharepoint-2010-document-sets-custom-ribbon-buttons-with-custom-code