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

formatting only in view mode

6 Answers 90 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Hitesh
Top achievements
Rank 1
Hitesh asked on 27 Oct 2012, 05:35 PM
number formatting like 23,344.45 should be displayed only in view mode. but when user enter it should display 23444.45 without formatting.
Below text property is not displaying data in N2 string format. what is correct way to use Value and Text property.?

 <RadMaskedNumericInput
 Value="{Binding  XXX, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" 
Mask="" Text={Binding StringFormat=N2}"/>

6 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 31 Oct 2012, 04:04 PM
Hello Hitesh,

You can take advantage of the ValueToTextConverter described in more details in our documentation. Basically it allows you to format the Text value based on the MaskedNumericInput.Value property. I attached a sample solution demonstrating how to use it to implement your requirement. Please have a look at it and let me know if it helps.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Hitesh
Top achievements
Rank 1
answered on 31 Oct 2012, 08:28 PM
Hi Tina,

Thanks for sample app. but i need reverse way. In view mode it should display formatting.

how i can apply convert on value to remove NumberGroupSeparator?

 

0
Tina Stancheva
Telerik team
answered on 05 Nov 2012, 03:26 PM
Hi Hitesh,

Please accept my apology for misunderstanding your scenario. The approach to implement your requirement is the same, however you need to remove the FormatString and change the ValueToTextConverter implementation.

I modified my solution to demonstrate the changes I have in mind. Please let me know if it helps.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Hitesh
Top achievements
Rank 1
answered on 06 Nov 2012, 02:49 PM
Tina,

Thanks for resolution. it is working but if value is only numbers like DoubleValue = 23344 then in edit mode it is not allowing to enter decimal value. it is considering as only numeric value since string format is not applied during edit mode.
0
Hitesh
Top achievements
Rank 1
answered on 06 Nov 2012, 08:01 PM
with FormatString="0"  or "0.00" is working fine in view mode.
0
Tina Stancheva
Telerik team
answered on 09 Nov 2012, 11:04 AM
Hello Hitesh,

I'm glad you found a solution. Let us know if you have more questions.

All the best,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Hitesh
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Hitesh
Top achievements
Rank 1
Share this question
or