Description
The SaveButton class displays a save button on a form. The save button renders on a form as a standard button. When a user clicks a SaveButton, SharePoint will save any changes to the current SharePoint list item, based on the context of the form. The SaveButton class exposes a ControlMode property which must be set to a value from the SPControlMode enumeration. The SaveButton control only renders when the ControlMode property is set to an appropriate value, for example, it will not render if the SPControlMode.Display value is used.
Usage Scenarios
You will typically use the SaveButton class when you create a custom form for editing items stored in a SharePoint list. When you use the SaveButton, SharePoint will vary the functionality of the button according to the context of the page.
The following code samples show how to instantiate a SaveButton object, set the ControlMode property of the SaveButton instance, and then, in the C# and Visual Basic .NET code samples, add the SaveButton to the controls collection of the page.
ASP .NET Markup Sample
<SharePoint:SaveButton runat="server" ID="CustomFormSaveButton" ControlMode="Edit" >
C# Code Sample
SaveButton CustomFormSaveButton = new SaveButton();
CustomFormSaveButton.ControlMode = SPControlMode.Edit;
this.Controls.Add(CustomFormSaveButton);
Visual Basic .NET Code Sample
Dim CustomFormSaveButton As SaveButton = New SaveButton()
CustomFormSaveButton.ControlMode = SPControlMode.Edit
Me.Controls.Add(CustomFormSaveButton)