locked
Relisting an ad displays the 'price' to 4 decimal places? RRS feed

  • Question

  • User-382622159 posted

     I notice that when I try to relist an 'inactive ad', from within the myads section, the 'postad.aspx?relistxx' page is diplayed with the original price but, to 4 decimal places and i would like only 2 decimal places. Does anyone know how to change this? I am using the final version of classifieds.

    Thanks

    Monday, October 26, 2009 5:11 PM

Answers

  • User730446648 posted

    Hey Phil,

     

    It's really easy.

    Just open your code behind page for postad.
    In my case it's PostAd.aspx.vb

     

    Scroll down towards the bottom and you will find a sub called LoadPreviousAd
    And you'll probably see this PriceTextBox.Text = ad.Price

    Change it to this:

    PriceTextBox.Text = String.Format("{0:f2}", ad.Price)

    Note the 2, it represents after the decimal.
    And the f tells it it's a number so over 1000 it adds a comma 1,000
    If you change the f to a c it will use a comma, and add your set currency, probably $.

    Good Luck

    Daniel

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 28, 2009 9:50 AM

All replies

  • User1256627138 posted

    Hi,

           If you want to do it in javascript,then use

                         var subTotal=0.0;subTotal.toFixed(2);

       for C#,

               Convert.ToDouble(txtAmount.Text.Trim()).ToString("F");

    where txtAmount contains the value

    Tuesday, October 27, 2009 6:31 AM
  • User-382622159 posted

    Hi  Rama,

    Thanks for your reply. Unfortunately I am such a newbie I have no idea where to place that line of code (C#) so if you are familiar with the classified kit could you help me further with that. And, do you know if the code wold be similar in VB, as that is my preferred code. Thanks.

    Phil

    Tuesday, October 27, 2009 7:10 AM
  • User730446648 posted

    Hey Phil,

     

    It's really easy.

    Just open your code behind page for postad.
    In my case it's PostAd.aspx.vb

     

    Scroll down towards the bottom and you will find a sub called LoadPreviousAd
    And you'll probably see this PriceTextBox.Text = ad.Price

    Change it to this:

    PriceTextBox.Text = String.Format("{0:f2}", ad.Price)

    Note the 2, it represents after the decimal.
    And the f tells it it's a number so over 1000 it adds a comma 1,000
    If you change the f to a c it will use a comma, and add your set currency, probably $.

    Good Luck

    Daniel

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 28, 2009 9:50 AM
  • User-382622159 posted

    Thanks Daniel,

    You came to my rescue again, thanks.

    Phil 

    Wednesday, October 28, 2009 12:13 PM
  • User-382622159 posted

     Hi again Daniel,

    Can I try and tap into your knowledge on this little bug querie? I posted it in the general bugs section but had no response from anyone yet and I've searched the forums to the point of giving up. The link to the post is:

    http://forums.asp.net/p/984238/3469843.aspx#3469843

    Thanks

    Phil

    Wednesday, October 28, 2009 12:19 PM