BeginUpdate;
The BeginUpdate method prohibits table contents rerendering.
The method is used to avoid possible table blinking when its settings are being changed. Rerendering is resumed and all made changes are applied after calling EndUpdate.
Executing the example requires that the repository contains a web form, the Button1 button on the form, and the DataGridView component named DataGridView1. A data source is connected to the DataGridView1 component.
Add links to the Express, Tab, and WebForms system assemblies.
Class TESTWebForm: WebForm
Button1: WebButton;
DataGridView1: WebDataGridView;
Sub Button1OnClick;
Var
DGView: IDataGridView;
Columns: IGridViewColumns;
Column: IGridViewColumn;
Style: ITabCellStyle;
i, c: Integer;
Begin
DGView := DataGridView1.DataGridView;
DGView.BeginUpdate;
Columns := DGView.Columns;
c := Columns.Count;
For i := 0 To c - 1 do
Column := Columns.Item(i);
// Title style
Style := Column.HeaderStyle;
Style.HorizontalAlignment := TabFormatAlignment.Center;
Style.VerticalAlignment := TabFormatLayout.Center;
// Data style
Style := Column.DataStyle;
Style.Font.Italic := TriState.OnOption;
// Hide column if name contains the RIGHTS word
If Column.Text.IndexOf("RIGHTS") <> -1 Then
Column.Visible := False;
End If;
End For;
DGView.TableStyle := TabTablePredefinedStyle.Orange;
DGView.EndUpdate;
End Sub Button1OnClick;
End Class TESTWebForm;
Clicking the button will change formatting settings of table title, data area, and will set the orange alternating style. If the table contains a column, which name contains the RIGHTS word, will be hidden.
See also: