How to get formatted text from RadNumericTextbox

5 posts, 1 answers
  1. Michal Siudyka
    Michal  Siudyka avatar
    11 posts
    Member since:
    Nov 2009

    Posted 08 Jun 2010 Link to this post

    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
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 09 Jun 2010 Link to this post

    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.
     
      double v = Convert.ToDouble(RadNumericTextBox1.Value);  
      string valueFormatted = String.Format("${0}", v.ToString("#,#.##", CultureInfo.InvariantCulture)); 


    Hope this helps,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Michal Siudyka
    Michal  Siudyka avatar
    11 posts
    Member since:
    Nov 2009

    Posted 09 Jun 2010 Link to this post

    I thought so that should be formatted manually, thanks.
  5. Answer
    Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 11 Jun 2010 Link to this post

    Hello Michal,

    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.
  6. Michal Siudyka
    Michal  Siudyka avatar
    11 posts
    Member since:
    Nov 2009

    Posted 11 Jun 2010 Link to this post

    Great, thanks a lot.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017