Click or drag to resize

PageDataGridDataItemClassOnSetColumnsReadOnly Method

Set column field edit or read only

Namespace:  SOWIWin.Helper
Assembly:  SOWIWin.Helper (in SOWIWin.Helper.dll) Version: 19.1.23.1 (19.1.23.622)
Syntax
protected virtual void OnSetColumnsReadOnly(
	Object sender,
	EventArgs e
)

Parameters

sender
Type: SystemObject
Sender is a PageDataGridUI object
e
Type: SystemEventArgs
Without parameter
Remarks
Method is event from object PageDataGridUI.

Normally puts columns edit or read only by DataGridView object (must a instance) property CanEdit

Examples
Standard use the DataGridView object. When uses a SOWI Win standard DataGrid Controller so puts the columns edit or read only in SetViewBag.

For a example see SetViewBag

Another way is overwrite this method and puts the columns edit or read only. See following examples:

private void SetColumnsReadOnly()
{
    bool lReadField = true;
    bool lEditField = false;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("ID")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("GUID")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("ClientID")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Name")].IsReadOnly = lEditField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("NameOriginalValue")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Label")].IsReadOnly = lEditField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Description")].IsReadOnly = lEditField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("DateTimeValue")].IsReadOnly = lEditField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Value")].IsReadOnly = lEditField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Text")].IsReadOnly = lEditField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Flag")].IsReadOnly = lEditField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Checked")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Selection")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("ColorUI")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("ActionText")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("ActionDB")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("TaskText")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Task")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("StatusText")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Status")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("CreateDate")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("CreateUser")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("LastEditDate")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("LastEditUser")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("DeleteDate")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("DeleteUser")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Archive")].IsReadOnly = lEditField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Help")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Database")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("ChangeTracker")].IsReadOnly = lReadField;
    this.PageDataGridUI.DataGridMain.Columns[GetColumnIndexByName("Configuration")].IsReadOnly = lReadField;
}
See Also