SPPageStateControl.EnsureItemSavedIfEditMode method (Boolean, String, String)

Ensures an item is saved to the server if it is necessary, forces a save if there are version conflicts, and specifies overwrite and discharge changes command handlers.

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Function EnsureItemSavedIfEditMode ( _
    forceSave As Boolean, _
    overwriteCommandHandler As String, _
    discardChangesCommandHandler As String _
) As Boolean
'Usage
Dim instance As SPPageStateControl
Dim forceSave As Boolean
Dim overwriteCommandHandler As String
Dim discardChangesCommandHandler As String
Dim returnValue As Boolean

returnValue = instance.EnsureItemSavedIfEditMode(forceSave, _
    overwriteCommandHandler, discardChangesCommandHandler)
public bool EnsureItemSavedIfEditMode(
    bool forceSave,
    string overwriteCommandHandler,
    string discardChangesCommandHandler
)

Parameters

  • forceSave
    Type: System.Boolean

    true forces the item to be saved even if there are version conflicts, before proceeding with the requested server action.

  • overwriteCommandHandler
    Type: System.String

    A string that contains the name of the overwrite command handler.

  • discardChangesCommandHandler
    Type: System.String

    A string that contains the name of the discard changes command handler.

Return value

Type: System.Boolean
true to ensure an item is saved; otherwise, false.

Remarks

If the command handler performs an action such as checking in or publishing a file to the server, it should call this method to save the item back to the server before the server performs the requested action. This method ensures that the item is saved if this action is required.

See also

Reference

SPPageStateControl class

SPPageStateControl members

EnsureItemSavedIfEditMode overload

Microsoft.SharePoint.WebControls namespace