Microsoft.SharePoint.WebCon ...


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)
Syntax

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
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.

Example

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)
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
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

Tags :


Community Content

Content Master Ltd
SaveButton

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)
Tags : sharepoint

Page view tracker