Spread ASP.NET 6.0 Product Documentation
Allowing Load on Demand
Send Feedback
Spread ASP.NET 6.0 Product Documentation > Developer's Guide > Customizing User Interaction > Customizing Interaction with the Overall Component > Allowing Load on Demand

Glossary Item Box

You can allow the Web page to load on demand -- as the user scrolls further down the spreadsheet the Spread component on the client loads another set of rows from the server as needed. The height of the component should be smaller than the height needed for the initial number of rows to load (LoadInitRowCount property); otherwise, the scroll bar will not be visible and you will need to use the next page icon instead of the scroll bar. The load on demand feature scrolls up to the maximum number of rows you have set with the page size. If the row count is greater than the page size, you will need to use the next page icon to display the rows beyond the page size setting.

The following properties are used to set the allow load on demand feature. They can be set at the control level or the sheet level.

FpSpread class:

SheetView class:

The load on demand feature is not intended to work with a hierarchical display (parent sheet expanding into child sheets) so it is disabled in a hierarchical Spread.

Virtual Paging

Another option for loading pages as the user scrolls vertically is the AllowVirtualScrollPaging property. This can be used instead of the allow load on demand properties. The virtual paging will not work with load on demand. The EnableClientScript property must be true for the virtual paging. For the best performance, you may also wish to set EnableAjaxCall to true since the virtual paging uses Ajax calls.

The virtual scrolling option scrolls from the first row to the last row of the page size. If the row count is greater than the page size, then when you scroll past the maximum page size row, the next set of rows is loaded (a wait icon is displayed while the next page is loading in this case).

The scroll bar button size reflects the total number of rows with virtual scrolling (rather than the number of currently loaded rows).

Return to the overview at Customizing Interaction with the Overall Component.

Using the Properties Window

You can set several of the properties at design time using the Properties window of Visual Studio .NET or the Property grid in the designer.

  1. Select the sheet.
  2. Set the AllowLoadOnDemand property to true to allow loading on demand.
  3. Set the LoadInitRowCount property to specify the initial number of rows to load.
  4. Set the LoadRowIncrement property to specify how many rows to load after the inital set of rows is loaded.

Using Code

Use the AllowLoadOnDemand property to allow load on demand. Set the LoadInitRowCount property to load the initial set of rows. Set the LoadRowIncrement property to specify the number of rows to load after the initial page is loaded.

Example

The height of the component should be smaller than the height of ten rows (for this example).

C# Copy Code
FpSpread1.Sheets[0].RowCount = 40;
FpSpread1.Sheets[0].AllowLoadOnDemand = True;
FpSpread1.Sheets(0).PageSize = 40;
FpSpread1.Sheets[0].LoadInitRowCount = 10;
FpSpread1.Sheets[0].LoadRowIncrement = 10;
long i;
for (i = 1; i <= 20; i++)
{
FpSpread1.Sheets[0].Cells[i, 0].Value = i;
}
VB Copy Code
FpSpread1.Sheets(0).RowCount = 40
FpSpread1.Sheets(0).AllowLoadOnDemand = True
FpSpread1.Sheets(0).PageSize = 40
FpSpread1.Sheets(0).LoadInitRowCount = 10
FpSpread1.Sheets(0).LoadRowIncrement = 10
Dim i As Long
For i = 1 To 20
FpSpread1.Sheets(0).Cells(i, 0).Value = i
Next
© 2002-2012 GrapeCity, Inc. All Rights Reserved.