Intersoft WebGrid Documentation
VirtualLoadMode Enumeration
Example  See Also  Send Feedback
ISNet.WebUI.WebGrid Namespace : VirtualLoadMode Enumeration






Value representing load mechanism to retrieve and render data in the WebGrid control

Syntax

Visual Basic (Declaration) 
Public Enum VirtualLoadMode 
   Inherits System.Enum
Visual Basic (Usage)Copy Code
Dim instance As VirtualLoadMode
C# 
public enum VirtualLoadMode : System.Enum 
Delphi 
public enum VirtualLoadMode = class(System.Enum)
JScript 
public enum VirtualLoadMode extends System.Enum
Managed Extensions for C++ 
__value public enum VirtualLoadMode : public System.Enum 
C++/CLI 
public enum class VirtualLoadMode : public System.Enum 

Members

MemberDescription
CustomThis mode allow 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.
DefaultThe default mode of VirtualLoad, only a number of rows specified in VirtualPageSize are processed by WebGrid.
LargeDataThe loaded data is relatively large and filled at once then handled by WebGrid automatically. In this mode, all rows specified in VirtualPageSize are processed by WebGrid.

Example

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 from server transparently and virtually 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, LargeData, and Custom.

Using LargeData option in the VirtualLoadMode property restricts the users to export ALL the data. Only a certain batch of data which has been retrieved by users, will be exported to the medium. Therefore, in order to export ALL data, the VirtualLoadMode property needs to be configured to Default option temporarily and invokes the RebindDataSource() method.

Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         ISNet.WebUI.WebGrid.VirtualLoadMode

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.