New to Telerik UI for WinForms? Download free 30-day trial


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.

WinForms RadGridView GridViewMaskBoxColumn

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);

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)

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 or Ctrl + 0 to clear the value in the editor.

See Also

In this article