This is a migrated thread and some comments may be shown as answers.

GridViewMaskBoxColumn

3 Answers 175 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Zahra
Top achievements
Rank 1
Zahra asked on 10 Dec 2012, 03:17 PM
Hello
I wanted to have a column which has thousand seprator  so I used "GridViewDecimalColumn" but when I typed in the cell the thousand separator
has been disappeared and when I left the cell it was shown again. as the result of this i decided to use "GridViewMaskBoxColumn" insted ,because
it hasnt those problem .
by using GridViewMaskBoxColumn  my problem solved but I face to another problem,I need to set maximum value to this column
but I cant define MaximumValue for this column ,please help me to do this.

  GridViewMaskBoxColumn dec = new GridViewMaskBoxColumn();
            dec.FieldName = "dec";
            dec.FormatString = "{0:#,##}";
            radGridView1.Columns.Add(dec);
           

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 13 Dec 2012, 02:31 PM
Hello Zahra,

Thank you for writing.

The GridViewMaskBoxColumn and our RadMaskedEditBox do not support Maximum and Miniumum values. In case that you need a Maximum \ Minimum,  you should use a GridViewDecimalColumn.

Do not hesitate to contact us if you have other questions.

Kind regards,
Peter
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Zahra
Top achievements
Rank 1
answered on 16 Dec 2012, 01:41 PM
ok thank you
I have another question I used the code bellow to create currency column
GridViewMaskBoxColumn maskBoxColumn = new GridViewMaskBoxColumn();
            maskBoxColumn.Name = "Price";
            maskBoxColumn.FieldName = "UnitPrice";
            maskBoxColumn.HeaderText = "Unit Price";
            maskBoxColumn.MaxLength = 5;
            maskBoxColumn.MaskType = MaskType.Numeric;
            //maskBoxColumn.Mask = "C";
            maskBoxColumn.TextAlignment = ContentAlignment.BottomRight;
            maskBoxColumn.FormatString = "{0:C}";
by using this code the problem with thousand separator solved ,but I dont want to see the currency symbol in this column
is this possible?
0
Accepted
Peter
Telerik team
answered on 19 Dec 2012, 03:18 PM
Hi Zahra,

Thank you for writing back.

You should change the C mask with N mask to achieve your goal. For example:
maskBoxColumn.FormatString = "{0:N}";

For more information you can refer to this blog post - String Formatting in C#.

I hope this helps.

Greetings,
Peter
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
GridView
Asked by
Zahra
Top achievements
Rank 1
Answers by
Peter
Telerik team
Zahra
Top achievements
Rank 1
Share this question
or