Specific cells can be set to read-only using the Cell.ReadOnly property. By default, the Cell.ReadOnly property is always set to True for cell types that are not editable, such as ButtonCell and HeaderCell.
Using Code
Use the following code to set the current cell to read-only.
[VB]
GcMultiRow1.CurrentCell.ReadOnly = True
|
[CS]
gcMultiRow1.CurrentCell.ReadOnly = true;
|
Using Code
The following code prevents user input in string type cells that are in edit mode; however, users can select or copy the string in the cell.
[VB]
Imports GrapeCity.Win.MultiRow
Private Sub GcMultiRow1_EditingControlShowing(ByVal sender As System.Object, ByVal e As EditingControlShowingEventArgs) Handles GcMultiRow1.EditingControlShowing
If TypeOf e.Control Is TextBoxEditingControl Then
TryCast(e.Control, TextBoxEditingControl).ReadOnly = True
End If
End Sub
|
[CS]
using GrapeCity.Win.MultiRow;
private void gcMultiRow1_EditingControlShowing(object sender, EditingControlShowingEventArgs e)
{
if (e.Control is TextBoxEditingControl)
{
(e.Control as TextBoxEditingControl).ReadOnly = true;
}
}
|
See Also