GridViewMaskBoxColumn
GridViewMaskBoxColumn allows restricted editing of text data. Each cell in GridViewMaskBoxColumn column displays the text of the cell Value property according to the settings of the TextAlignment (default is ContentAlignment.MiddleLeft), WrapText (default is false) and FormatString properties.
You can set a mask to GridViewMaskBoxColumn using its Mask and MaskType properties. You can find further information about the possible values for these properties in RadMaskEditBox documentation section.
You can use FormatString property to format the values of GridViewMaskBoxColumn cells not currently opened for editing.
Add GridViewMaskBoxColumn to the grid.
GridViewMaskBoxColumn maskBoxColumn = new GridViewMaskBoxColumn();
maskBoxColumn.Name = "Price";
maskBoxColumn.FieldName = "UnitPrice";
maskBoxColumn.HeaderText = "Unit Price";
maskBoxColumn.MaskType = MaskType.Numeric;
maskBoxColumn.Mask = "C";
maskBoxColumn.TextAlignment = ContentAlignment.BottomRight;
maskBoxColumn.FormatString = "{0:C}";
maskBoxColumn.DataType = typeof(decimal);
radGridView1.MasterTemplate.Columns.Add(maskBoxColumn);
Dim maskBoxColumn As New GridViewMaskBoxColumn()
maskBoxColumn.Name = "Price"
maskBoxColumn.FieldName = "UnitPrice"
maskBoxColumn.HeaderText = "Unit Price"
maskBoxColumn.MaskType = MaskType.Numeric
maskBoxColumn.Mask = "C"
maskBoxColumn.TextAlignment = ContentAlignment.BottomRight
maskBoxColumn.FormatString = "{0:C}"
maskBoxColumn.DataType = GetType(Decimal)
RadGridView1.MasterTemplate.Columns.Add(maskBoxColumn)
The GridViewMaskBoxColumn also supports null values and this functionality can be enabled by setting the EnableNullValueInput property of the column to true. The default value of the property is set to false. Once this is enabled you can use
Ctrl + Delete
orCtrl + 0
to clear the value in the editor.