GridNumericColumn with Negative Value

12 posts, 0 answers
  1. Brian Chavez
    Brian Chavez avatar
    23 posts
    Member since:
    Sep 2012

    Posted 08 Feb 2009 Link to this post

    Hi,

    How do I make the GridNumericColumn display negative numbers in the folowing "$ -40.00" format.  RadNumericTextbox has a NegativePattern, but I'm not able to set a negative pattern in GridNumericColumn.  GridNumericColumn seems to display negative values in "($40.00)" format.

    This is annoying.

    Thanks,
    Brian
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Feb 2009 Link to this post

    Hi Brian,

    Try setting the DataFormatString instead of setting the NumericType property. Try the following ASPX for GridNumericColumn. Hope this helps.

    <telerik:GridNumericColumn DataField="UnitPrice" DataType="System.Decimal" DataFormatString="${0}" HeaderText="NumericColumn"
    </telerik:GridNumericColumn> 

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. rick
    rick avatar
    11 posts
    Member since:
    Nov 2007

    Posted 01 May 2009 Link to this post

    I'm using the GridCalculatedColumn and would like to show the NumericType as currency (23.00) rather than -23.00. How is this achieved in the GridCalculatedColumn?

     

  5. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 04 May 2009 Link to this post

    Hi rick,

    I replied to your question in the support ticket you opened with regards to this subject. I am pasting the response in this forum thread as well:

    Can you please try setting DataType = "System.Decimal" and appropriate DataFormatString for the GridCalculatedColumn you mentioned to format the numeric value in it in par with your preferences? Let me know whether this produces the desired result.

    Best regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Johann Herunter
    Johann Herunter avatar
    9 posts
    Member since:
    Nov 2009

    Posted 09 Dec 2009 Link to this post

    Hello,

    I'm having the same problem when assigning a negative format pattern, but need to support automatic currency assignment.

    The RadNumericTextBox gets the format "$-n" assigned, which works good for negative numbers for Dollar.

    With using the DataFormatString "${0}" (as suggested), the number displays correctly, but changing the currency (using a new CultureInfo object on the Thread.CurrentThread.CurrentCulture) to Euro, the Dollar symbol is not replaced with the Euro symbol.

    We need to display positive and negative numbers in Dollar and Euro, which must be changed at runtime.

    The only way seems to assign the CurrencyNegativePattern on the current Thread, which is a problem in the environment the grid is running in.

    Could you please give a suggestion, how it is possible to assign a currency-indepentend format for both positive and negative values?

    Regards,
    Johann
  7. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 14 Dec 2009 Link to this post

    Hello Johann,

    You need to include the relevant currency symbol explicitly either separately or as part of the value which is processed by the column's DataFormatString. See how this is done programmatically for the Currency column on the following online demo of RadGrid for ASP.NET AJAX:

    http://demos.telerik.com/aspnet-ajax/grid/examples/client/columnformatting/defaultcs.aspx

    and try it in your case to see whether this produces the desired result.

    Best regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 22 Jul 2014 in reply to Shinu Link to this post

    we have a requirment where we need commas in usd currency format along with $ and minus sign but when we try to put commas with 0:c it shows commas but it encodes negative values in braces and we want minus sign and instead of showing negative values in braces. any solution ?
  9. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 25 Jul 2014 Link to this post

    Hello Asutosh,

    You can use a custom formatting to achieve the requested appearance:
    double value = -2.54;
    string formattedValue = string.Format("{0:$#.##;$-#.##}", value);

    Hope this helps. Please give it a try and let me know if it works for you.

    Regards,
    Eyup
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  10. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 25 Jul 2014 in reply to Eyup Link to this post

    we want to bind this formate in radgrid and radhtml chart 
    how to do that in that?
  11. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 25 Jul 2014 Link to this post

    Hello Asutosh,

    You can use the corresponding properties of the controls to apply the desired formatting:
    <telerik:GridNumericColumn ... DataFormatString="{0:$#.##;$-#.##}">

    That should do the trick.

    Regards,
    Eyup
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  12. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 25 Jul 2014 in reply to Eyup Link to this post

    thanks for reply
    and what about radhtml chart?
  13. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 30 Jul 2014 Link to this post

    Hello Asutosh,

    If you want to format values in RadHtmlChart's labels or tooltips you can also use the DataFormatString property. If you want, however, to format values in templates you must use kendo.format() method. More information on the matter is available in the following set of help articles:

     - Formatting Dates
     - Formatting Numbers
     - Overview

    Regards,
    Danail Vasilev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017