DataRepeater.VirtualMode Property

Gets or sets a value that indicates whether you have provided your own data-management operations for the DataRepeater control.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

public bool VirtualMode { get; set; }

Property Value

Type: System.Boolean
true if the DataRepeater uses data-management operations that you provide; otherwise, false. The default is false.

Virtual mode is designed for use with large stores of data. When the VirtualMode property is set to True, you create a DataRepeater with a set number of items and then handle the ItemValueNeeded event to populate the items. Virtual mode requires implementation of an underlying data cache to handle the population, editing, and deletion of DataRepeater items based on actions of the user. For more information about how to implement virtual mode, see Virtual Mode in the DataRepeater Control.

The following code example demonstrates how to change the behavior of a DataRepeater control in the Form_Load event handler, depending on the value of the VirtualMode property. It assumes that you have a form that contains a DataRepeater control named DataRepeater1 that is bound to the Products table of the Northwind database.

// If the DataRepeater is in virtual mode,  
// do not allow adds or deletes. 
if (dataRepeater1.VirtualMode == true)
    dataRepeater1.AllowUserToAddItems = false;
    dataRepeater1.AllowUserToDeleteItems = false;
    // Disable the Add button.
    productsBindingNavigator.AddNewItem.Enabled = false;
    // Disable the Delete button.
    productsBindingNavigator.DeleteItem.Enabled = false;

Community Additions