Michal Siudyka
Top achievements
Rank 2
Michal Siudyka
asked on 08 Jun 2010, 03:30 PM
Hi,
I have created a RadNumericTextbox control and set the NumberFormat's properties. Everything is displayed correctly, but how can I get programmatically the formatted text.
i.e.
A control displays: $ 1,223.34
in code:
string value = control.Text;
and the value equals 1223.34 and I want to get $ 1,223.34
Thanks in advance
4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 09 Jun 2010, 07:38 AM
Hi Michal,
I am not sure about any property available for retrieving the exact formatted value from RadNumericTextBox.
But you can accomplish same by using following code.
Hope this helps,
Princy.
I am not sure about any property available for retrieving the exact formatted value from RadNumericTextBox.
But you can accomplish same by using following code.
double v = Convert.ToDouble(RadNumericTextBox1.Value); |
string valueFormatted = String.Format("${0}", v.ToString("#,#.##", CultureInfo.InvariantCulture)); |
Hope this helps,
Princy.
0
Michal Siudyka
Top achievements
Rank 2
answered on 09 Jun 2010, 09:27 PM
I thought so that should be formatted manually, thanks.
0
Accepted
Hello Michal,
It is possible to get the formatted value. Here is how:
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
It is possible to get the formatted value. Here is how:
string
formattedValue = Telerik.Web.UI.NumberFormat.Format(RadNumericTextBox1.Value, RadNumericTextBox1.NumberFormat);
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Michal Siudyka
Top achievements
Rank 2
answered on 11 Jun 2010, 03:33 PM
Great, thanks a lot.