Spread for ASP.NET 7.0 Product Documentation
SaveOrLoadSheetState Event
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > FpSpread Class : SaveOrLoadSheetState Event


Glossary Item Box

Occurs when the user saves or loads a view state of a sheet.

Syntax

Visual Basic (Declaration) 
Public Event SaveOrLoadSheetState As SheetViewStateEventHandler
Visual Basic (Usage)Copy Code
Dim instance As FpSpread
Dim handler As SheetViewStateEventHandler
 
AddHandler instance.SaveOrLoadSheetState, handler
C# 
public event SheetViewStateEventHandler SaveOrLoadSheetState

Event Data

The event handler receives an argument of type SheetViewStateEventArgs containing data related to this event. The following SheetViewStateEventArgs properties provide information specific to this event.

PropertyDescription
Handled Gets or sets whether the event has been handled.
Index Gets the index of the collection that contains the sheet.
IsSave Gets whether the state of the sheet is saved.
SheetView Gets the sheet whose state is to be loaded or to be saved.

Remarks

When the SaveViewStateToSession property is true, spread saves its view state to the Session object. And, the SaveOrLoadSheetState event is not fired. If you do not want to save the spread view state to the Session object, you should set this property to false. The default value is true.

Example

This example illustrates the use of the event.
C#Copy Code
private void FpSpread1SaveOrLoadSheetState(object sender, FarPoint.Web.Spread.SheetViewStateEventArgs e)  
{
    if (e.IsSave)
    { 
        Session["SheetName" + e.Index] = e.SheetView.SaveViewState();
    } 
    else
    { 
        e.SheetView.LoadViewState(Session["SheetName" + e.Index]); 
    }
    e.Handled = true; 
}
Visual BasicCopy Code
Private Sub FpSpread1SaveOrLoadSheetState(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.SheetViewStateEventArgs)
Handles FpSpread1.SaveOrLoadSheetState 
    If (e.IsSave) Then 
        Session("SheetName" & e.Index) = e.SheetView.SaveViewState() 
    Else 
        e.SheetView.LoadViewState(Session("SheetName" & e.Index)) 
    End If 
    e.Handled = True 
End Sub 

Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.