Share via


SaveButton Class

Provides a button, usually on a form toolbar, that is used to save a new or edited list item on the form.

Inheritance Hierarchy

System.Object
  System.Web.UI.Control
    Microsoft.SharePoint.WebControls.SPControl
      Microsoft.SharePoint.WebControls.TemplateBasedControl
        Microsoft.SharePoint.WebControls.FormComponent
          Microsoft.SharePoint.WebControls.SaveButton
            Microsoft.SharePoint.WebControls.PublishButton
            Microsoft.SharePoint.WebControls.SaveAsDraftButton
            Microsoft.SharePoint.WebControls.SubmitCommentButton

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public Class SaveButton _
    Inherits FormComponent
'Usage
Dim instance As SaveButton
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class SaveButton : FormComponent

Remarks

The SaveButton control will not render if the ControlMode value is Display.

Use the SaveButton class when you create a custom form for creating or editing items stored in a list.

Examples

The following code samples show how to instantiate a SaveButton object, set the Text, and then, in the C# and Visual Basic .NET code samples, add the SaveButton to the controls collection of the page.

[xml]

<SharePoint:SaveButton runat="server" ID="CustomFormSaveButton" Text="Create!" >

[C#]

SaveButton CustomFormSaveButton = new SaveButton();
this.Controls.Add(CustomFormSaveButton);

[Visual Basic]

Dim CustomFormSaveButton As SaveButton = New SaveButton()
Me.Controls.Add(CustomFormSaveButton)

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SaveButton Members

Microsoft.SharePoint.WebControls Namespace