Edit this page

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.

gridview-columns-gridviewmaskboxcolumn 001

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.

note

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)

See Also