.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to override functionality of the Ribbon Save button ?

Posted By:      Posted Date: October 28, 2010    Points: 0   Category :SharePoint

Dear all,

I have a custom editform for my library which I generated using SharePoint Designer.

This custom form also includes the Save button on the form itself along with the the ribbon save button. I need to add additional functionality to my save.

The button on the form is a SharePoint:SaveButton webcontrol...

< SharePoint:SaveButton runat="server"/>

I can override this adding my own functionality like this

public class CustomSaveButton : SaveButton
 Control c;
 protected override void OnInit(EventArgs e)

 protected override bool SaveItem()
	// Do the custom code here..
	return base.SaveItem();

After this I can add back my custom save to the form.. like below

<%@Assembly Name="CustomOverrideControls, Version=, Culture=neutral, PublicKeyToken=uhdsksuew9832iwe82" %>

<CustomOverrideControls:CustomSaveButton TemplateName="SaveButtonNew" runat="server"/>


All this is fine.. but what if the user skips this button and clicks on the 'Save' button on the Ribbon.. my custom code will not be executed :(

Question is how can I override the save functionality of the Ribbon Save button ?

Any help appreciated.



View Complete Post

More Related Resource Links

Ribbon Save Button Causes Validation


On a publishing site in 2010, it appears that the ribbon save button triggers validation on validators that have a specific validation group defined.  I'm confused as to how this happens, but it apparently does.

I have a web part with a simple input form and some validators.  When switching out of edit mode, the validators are triggered and the page won't switch back to normal view.

Any ideas?

Creating a "Save Button" in a browser based Form

I'm not sure if I'm missing something obvious, but I need to have the funtionality of the "Save Button", which is available and works on the tool bar, available in the form...and I can't seem figure out how to do it.I've found examples, in this forum, of how to use the "Submit Button" to act as the "Save Button", which did work for me, but only when specific basic criteria was met.The criteria that I now have is that I'm initiating a workflow to automatically start when a new item is created.  My workflow then moves the form to one of a few possible different form libraries, based on the logic in my workflow.  The different form libraries are to manage different teams of people that would have access to the Form and then that team would process the form accordingly.My specific situation: 1 - User opens a new form (works) 2 - User enters data and then submits the new form (works) 3 - Workflow is initiated and the form is moved to another form library to be worked on by a select group of people (works) 4 - The form is opened and reviewed and some changes are made to the form data by the select group of people (works) 5 - The form data in the form libary is updated (works, but only if the save button is pressed in the tool bar and then manually closes t

Customize Form button now showing up on ribbon

I used SP2010 Beta for 7 months and the Customize Form button was available on the ribbon for lists. Now, I am on the RTM, and cannot figure out how to show this button. Is it a feature? Do you have to have InfoPath 2010 installed locally? (I do have this, but just wondering). Thanks in advance.

How to display the edit button etc on the ribbon irrespective of who has checked it out

Is there a way that i can get the edit button etc displayed for all users irrespective of who has checked it out? Actually,i need the ribbon's edit,browse,page publish buttons active on the page even if somebody else has checked it out.I remember seeing an override checkout option available on the ribbon in some other site,But i do not have any such options displayed(I am also logged in and have full permissions).

need help to implement validation with save button

hi, i was defeated a problem relating to the save button. i am running vb.net 2005 and the database is access. i have a project with application so there's a form which i wanted to restrict the user to fill all the textfields. say there are 5 textfiled(Fname, email and so on). what i am interested is that when even some one open the form and tries to fill some of them, there should be prompting message asking them to fill all, else the save button has to do its task. here's the code i was playing around but got a problem that when i fill all the text fields, there's no save only the restricting msg appears(" plz, fill the form probably then click save") NB: i put this code inside the save button. --------------------------------------------------------------- Dim success As Boolean Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click If Product_DetailsBindingSource.Current Is Nothing Then MessageBox.Show("plz, fill the  feilds then click save button", Me.Text) success = False Else Me.Validate() success = DirectCast(Product_DetailsBindingSource.Current, products).Save() MessageBox.Show("save has completed successfully") Panel1.Show() End If   ------------------------ thanks so mch best regards hossenel

Enable Disable Save Button in Winforms App

Hi, In our windows forms application we have many forms with "Save" buttons. We want to enable them only if the data in the form is changed. At the moment it is handed by adding flags to check whether the data is dirty. Is there any easy way to handle this? May be something with the famework? Thanks,CJ

How to enable "Save" Ribbon from a webpart?

Hi there, I've created a webpart for PDP. This webpart will display/update custom fields value for project. However, when I put the webpart on the PDP page. The Save ribbon is not enabled (I clicked edit to check out the project pdp)..So how do I enable this Save Ribbon?..... Thank you,Joe

How to catch Save Ribbon event from code-behind for the custom webpart

Hi there, How can a custom web part(sitting on top of PDP) catch the Save Ribbon event from code? I’ve been looking around for solution, but not yet find one…. Thank you, —JoeJoe

Catch Save Ribbon Event from code-behind for webpart control

Hi there, How can a custom web part catch the Save Ribbon event from code-behind? Thank you, —JoeJoe

Confirmation prompt when click on "save" button?

Currently I am working on SharePoint 2010 project that my customer want something like confirmation prompt, (e.g. upon click on “save” button, system prompts “are you sure you want to save?”) for all following 8 area: ·         Document Repository (meta-data) ·         Calendaring ·         News ·         Task List ·         Quick Links ·         Blogs ·         Wiki ·         Forums   Is this possible?  Has anyone done this or something similar?  Can anyone point me to some examples or best practices when doing this? Thanks Believing is Seeing

Catch Save Ribbon Event from code-behind for webpart control

Hi there, How can a custom web part catch the Save Ribbon event from code-behind? Thank you, —JoeJoe

Trim "New Quick Step" ribbon button

Hi all. I succesfully trimed two buttons from: Library Tools - Library - Cutomize Library using :  ribbon.TrimById("Ribbon.Library.CustomizeLibrary.EditList"); ribbon.TrimById("Ribbon.Library.CustomizeLibrary.EditDefaultForms");   Just cannnot find Control ID for "New Quick Step" button here: http://msdn.microsoft.com/en-us/library/ee537543.aspx Help, please. Thanks.  

find the label control of gridview in save button event in C#

hi, every one..i want save the gridview in buttonsave event..here i wrote the code like thisfor (int i=0;i<gridview1.row.count;i++){label lbl=(label)gridview1.rows[i].findcontrol("lbl");Textbox txtname=(Textbox)gridview1.rows[i].findcontrol("txtname");}here i got the textbox value but am not getting label value how to get that label value..thanks in advance

How to add a new button to the newform.aspx page which says "Save and add another record" ?

Team, I have a scenario where my client wants me to add a nother button to NewForm.aspx page in addition to Save and Cancel buttons. The job of that buttom should be to save the record and open that new form again. Is this possible.If yes can you guie me how to do it though designer? Thanks in advance. Deepti.  

How can you remove the Save button on a survey?

What options are there to remove the SAVE button from a SharePoint survey?I need to remove this if possible, I was hoping it would be as simple as editing a form in the Survey list... but that is apparently not the case.I need to supress the SAVE button as it confuses end users and we don't want any half completed surveys. Either it gets finished or not at all.Can someone hopefully provide me with an nice simple solution?  Or any solution at all :)Thanks!

Button in Ribbon.ListItem.New doesn't appear when list is added via a webpart


I have added a button to a project task list (id = 150).
Everything works fine when I directly use the list. But when I add the list via a webpart to the site page my new button is not available. It's exactly the same ribbon as in the list view but my new button is not visible. Any suggestions?

  Title="Ribbon Customization for a Content Type">
    <CommandUIDefinition Location="Ribbon.ListItem.New.Controls._children">

Binding a Button's Content property to an XPath query, Accelerator functionality is lost



I'm using WPF 3.5.

I'm binding a button's Content property to an XPath query, and all is well until I try to make use of the Accelerator feature. 

When I hardcode the text, and place an _ (underscore) in the content, it renders as an accelerator key when the Alt key is pressed.  However, when the content is a binding expression that uses an XPath query, the underscore does not render as an accelerator key.  It simply appears as part of the content. 

Here is some simplified XAML code to illustrate:

<UserControl x:Class="Myapp.UI.Screens.PortalScreens.Portal"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
		<XmlDataProvider x:Key="languageResources" d:IsDataSource="True" Source="Resources\Language\English.xml" />
<Grid x:Name="layoutRoot">
		<Button x:Name="ExitButtonWithHardCodedText" Grid.Row=&quo
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend