Introduction
In this topic, we are going to describes different modes of Aspose.Grid.Web. These modes are just differentiated logically due to their different features and behaviors. We have identified three kinds of modes that include:
- Edit Mode
- View Mode
- Session Mode
- Sessionless Mode
All of these modes have their own characteristics. Developers can work with Aspose.Grid.Web in any mode according to their requirements. Let's deal with each mode one by one.
Edit Mode
By default, Aspose.Grid.Web control is in Edit Mode. Once in Edit Mode, developers can fully edit or modify the Grid content using all features offered by Aspose.Grid.Web control. These features include saving Grid content to Excel files, submitting data to server, calculating formulas, undo or discard previous actions, managing rows and columns, cut,copy or paste data, formatting cells etc.
|
Figure: GridWeb control in Edit Mode
|
Developers can also switch to Edit Mode programmatically by setting the EditMode property of GridWeb control to true.
Example:
[C#]
//Enabling the Edit Mode of GridWeb
GridWeb1.EditMode=true;
[VB.NET]
'Enabling the Edit Mode of GridWeb
GridWeb1.EditMode = True
NOTE: Whenever a user clicks Undo button, it doesn't cancel previous actions one by one but it brings GridWeb to its previous state (that was before last postback to the server).
View Mode
When GridWeb control is in View Mode then users cannot edit or modify Grid content, which means that users can only view Grid content. That's why this mode is called View Mode. In View Mode, few tab buttons (that is Submit, Save & Undo) are made hidden and Popup Menu (that appears on right click of the mouse) is shrinked to contain only Copy feature as shown below in the figure:
|
Figure: GridWeb control in View Mode
|
If developers would like their users to only view data then they can switch to View Mode programmatically by setting the EditMode property of GridWeb control to false.
Example:
[C#]
//Enabling the View Mode of GridWeb
GridWeb1.EditMode=false;
[VB.NET]
'Enabling the View Mode of GridWeb
GridWeb1.EditMode = False
NOTE: Even in View Mode, users can change the heights and widths of rows & columns respectively.
Session Mode
Aspose.Grid.Web control holds sheet data in the User Session of the web server between each requests of a web user. It means that GridWeb control always works in Session Mode by default. However, if developers are not working in Session Mode then they switch it on by setting the EnableSession property of GridWeb control to true.
Example:
[C#]
//Enabling the Session Mode of GridWeb
GridWeb1.EnableSession=true;
[VB.NET]
'Enabling the Session Mode of GridWeb
GridWeb1.EnableSession = True
Sessionless Mode
We have already discussed Session Mode approach that provides highest performance by using User Session to load and store sheet data but it consumes some server memory. So, if there are large number of concurrent users then memory problems may arise. To save server memory and support large number of concurrent users, developers may consider the "Sessionless Mode" of GridWeb control.
Sessionless Mode can be turned on by setting the EnableSession property of GridWeb control to false.
Example:
[C#]
//Enabling the Sessionless Mode of GridWeb
GridWeb1.EnableSession=false;
[VB.NET]
'Enabling the Sessionless Mode of GridWeb
GridWeb1.EnableSession = False
IMPORTANT: When EnableSession property of GridWeb control is set to false then the grid will store its data in the page's ViewState. That means the rendered page will be larger, and it will consume more network traffic.
NOTE: If you want to use SQL Server or StateServer to hold sessions then you would have to use Session Mode. GridWeb control(since version 1.9.1.1) supports serializing its data to SQL Server or StateServer.