GrapeCity MultiRow Windows Forms Documentation
Data Binding Modes

The GcMultiRow control supports three data binding modes and the user can select the mode they want to use.

Unbound (Disconnected) Mode

Unbound mode is applicable when displaying relatively small amounts of data. In this mode, there is no direct connection with the data source, and all the data is stored in the GcMultiRow control. This mode can be used when data is provided in the read-only mode in the form of tables, or when you are coding for the data source connectivity independently. The GcMultiRow control works in unbound mode when the GcMultiRow.DataSource property is empty, and the GcMultiRow.VirtualMode property is set to False. For details on working with data in the unbound mode, refer to Get and Set Data.

Bound Mode

Bound mode implies that you are connecting to a data source and are reading, writing, and synchronizing the data. In this mode, all the data is saved in the data source, and the values in the GcMultiRow control are updated automatically. When you make changes in the GcMultiRow control, the changes get updated automatically. This mode can be used in structuring general database applications. The GcMultiRow control works in bound mode when a data source has been set with the GcMultiRow.DataSource property and the GcMultiRow.VirtualMode property has been set to False.

Using Code

The following code displays the data source values in bound mode.

[VB]

GcMultiRow1.DataSource = myDataSet
GcMultiRow1.DataMember = myDataSet.Tables(0).TableName

[CS]

gcMultiRow1.DataSource = myDataSet;
gcMultiRow1.DataMember = myDataSet.Tables[0].TableName;

For details on bound mode, refer to Connecting to Database.

Virtual Mode

Virtual mode applies to cases where large amounts of data need to be handled quickly. The GcMultiRow control does not read the data automatically in this mode. The developer handles the timing for updates and changes to the display and transfers of data. This mode is suited for cases where you need to improve the performance by maintaining only the minimum required data.

The GcMultiRow control works in virtual mode when the GcMultiRow.VirtualMode property is set to True. In virtual mode, the CellValueNeeded event is fired when data is required in the grid. This includes the scrolling and re-rendering of the form.

Using Code

The following code displays the cell coordinates using the GcMultiRow.CellValueNeeded event.

[VB]

Imports GrapeCity.Win.MultiRow

Private Sub Form1_Load( _
    ByVal sender As System.Object, ByVal e As System.EventArgs _
    ) Handles MyBase.Load
    GcMultiRow1.ReadOnly = True
    GcMultiRow1.VirtualMode = True
    GcMultiRow1.RowCount = 1000
End Sub

Private Sub GcMultiRow1_CellValueNeeded( _
    ByVal sender As System.Object, ByVal e As CellValueEventArgs _
    ) Handles GcMultiRow1.CellValueNeeded
    e.Value = String.Format("{0},{1}", e.RowIndex, e.CellIndex)
End Sub

[CS]

using GrapeCity.Win.MultiRow;

private void Form1_Load(object sender, EventArgs e)
{
    gcMultiRow1.ReadOnly = true;
    gcMultiRow1.VirtualMode = true;
    gcMultiRow1.RowCount = 1000;
}

private void gcMultiRow1_CellValueNeeded(object sender, CellValueEventArgs e)
{
    e.Value = string.Format("{0},{1}", e.RowIndex, e.CellIndex);
}

The CellValuePushed event fires when the data is required in the grid. This event fires when the user or the developer inputs data in the grid.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options