Click to Rate and Give Feedback

  Switch on low bandwidth view
Community Content
In this section
Statistics Annotations (0)
SaveButton Class (Microsoft.SharePoint.WebControls)
Provides a button, usually on a form toolbar, that is used to save a new or edited list item on the form.

Namespace: Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Visual Basic (Declaration)
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class SaveButton
    Inherits FormComponent
Visual Basic (Usage)
Dim instance As SaveButton
C#
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
public class SaveButton : FormComponent

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.

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)
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
SaveButton      Content Master Ltd   |   Edit   |   Show History

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)
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker