SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software

Development Forums for Programmer, Administrators and Users

Development resources, articles, tutorials, code samples and tools and downloads for ASP.Net, SQL Server, R Script, Windows, Windows Phone, AWS, SAP HANA and ABAP, like SAP UI5, Screen Personas, etc.

Formating the string before displaying in ASP.NET

Last post 05-02-2010, 7:10 AM by eralper. 1 replies.
Sort Posts:
  •  04-29-2010, 4:44 AM 20970

    Formating the string before displaying in ASP.NET

    In Some cases while displaying a large number it will be nice if we can format the number to a more readable format
    Like : Reputation Point : 537456
    Can be more readable if we can write it as Reputation Point : 537,456
    ASP.NET provide features like String.Format(format,arg0) to format arguments into different forms.
    For above solution you can implement

    Response.Write(String.Format("{0:#,###}", 123456789));
    Which will print 123,456,789

    {0:#,###} → Known as the format string where “{ ,}”are compulsory to mentation.
    The first part before ':' represent the argument number & it will be an integer.
    The second part after ':' represent the format that you want your argument to be converted.

  •  05-02-2010, 7:10 AM 20975 in reply to 20970

    Re: Formating string before displaying in ASP.NET

    Thanks for the sample ASP.NET code that can be used to format string in ASP.NET using String.Format method.
View as RSS news feed in XML
Copyright © 2004 - 2020 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems