Intersoft WebGrid Documentation
CustomVirtualLoad Class
Members  Example  See Also  Send Feedback
ISNet.WebUI.WebGrid Namespace : CustomVirtualLoad Class






Customized class that enables more data to be retrieved from server transparently and virtually as users scroll the data forward.

Object Model

CustomVirtualLoad Class

Syntax

Visual Basic (Declaration) 
Public Class CustomVirtualLoad 
Visual Basic (Usage)Copy Code
Dim instance As CustomVirtualLoad
C# 
public class CustomVirtualLoad 
Delphi 
public class CustomVirtualLoad 
JScript 
public class CustomVirtualLoad 
Managed Extensions for C++ 
public __gc class CustomVirtualLoad 
C++/CLI 
public ref class CustomVirtualLoad 

Example

 

The following sample codes show you how to create grid in Custom VirtualPaging mode programmatically.
C#Copy Code
private void WebGrid1_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
{

  string sortExpression = "";

  // get all sort expression with GetSortExpression method

  if (WebGrid1.RootTable.SortedColumns.Count > 0) sortExpression = " order by " + WebGrid1.RootTable.SortedColumns.GetSortExpression();

  // select only required top x from your table. The RequestedRows is automatically determined by the control.

  OleDbDataAdapter da = new OleDbDataAdapter("select top " +    WebGrid1.VirtualLoadArgs.RequestedRows.ToString() + " * from [order details]" + sortExpression, oleDbConnection1);
  da.Fill(orderDetails1.Order_Details);

  oleDbConnection1.Open();
  OleDbCommand cmd = new OleDbCommand("select count(*) from [order details]", oleDbConnection1);

  // the grid need to know the original count of your table, in order for the control to know whether there are more data to fetch or not.
  WebGrid1.VirtualLoadArgs.TotalDataSourceRows = int.Parse( cmd.ExecuteScalar().ToString() );
  oleDbConnection1.Close();
   
  e.DataSource = orderDetails1;
}

Remarks

One of the WebGrid.NET’s key innovations is its ability to fetch more data as you scrolled down to the bottom edge of grid. In WebGrid.NET version 4.0 users are allowed to set the VirtualLoadMode, which is appropriate for the enterprise-class application scenarios where the size of database is relatively large and getting larger as the business grows. There are three modes of VirtualLoadMode:

  • Default : The default mode of VirtualLoad. The grid will display data based on the number on  VirtualPageSize.    
  • LargeData: This mode is suitable for scenarios where the loaded datasource is relatively large and filled at once then handled by WebGrid automatically. The difference with Default mode is only a number of rows specified in VirtualPageSize are processed by grid, while Large mode processed all rows.
  • Custom: This mode allows developers to handle the data fetching logic, such as filling only a number of rows at first page load, then load more data as requested in VirtualLoadArgs.RequestedRows property. With the flexibility offered in this mode, it enables you to load any size of table efficiently and effectively.

Inheritance Hierarchy

System.Object
   ISNet.WebUI.WebGrid.CustomVirtualLoad

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.