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

Last post 10-28-2009 12:19 PM by flostin. 5 replies.

Sort Posts:

  • Relisting an ad displays the 'price' to 4 decimal places?

    10-26-2009, 5:11 PM
    • Member
      18 point Member
    • flostin
    • Member since 08-26-2009, 3:13 PM
    • Posts 19

     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

  • Re: Relisting an ad displays the 'price' to 4 decimal places?

    10-27-2009, 6:31 AM
    • Member
      78 point Member
    • ramanselva
    • Member since 11-28-2007, 3:03 PM
    • India
    • Posts 19

    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

    Please remember to click “Mark as Answer” on the post that helps you.
    This can be beneficial to other community members reading the thread.

    Regards,
    Rama Selvam M.
  • Re: Relisting an ad displays the 'price' to 4 decimal places?

    10-27-2009, 7:10 AM
    • Member
      18 point Member
    • flostin
    • Member since 08-26-2009, 3:13 PM
    • Posts 19

    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

  • Re: Relisting an ad displays the 'price' to 4 decimal places?

    10-28-2009, 9:50 AM
    • Contributor
      2,564 point Contributor
    • darkknight187
    • Member since 09-14-2006, 4:35 AM
    • Bothell, Washington
    • Posts 1,008

    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

     

    Please remember to click “Mark as Answer” on the post that helps you.
    This can be beneficial to other community members reading the thread.
  • Re: Relisting an ad displays the 'price' to 4 decimal places?

    10-28-2009, 12:13 PM
    • Member
      18 point Member
    • flostin
    • Member since 08-26-2009, 3:13 PM
    • Posts 19

    Thanks Daniel,

    You came to my rescue again, thanks.

    Phil 

  • Re: Relisting an ad displays the 'price' to 4 decimal places?

    10-28-2009, 12:19 PM
    • Member
      18 point Member
    • flostin
    • Member since 08-26-2009, 3:13 PM
    • Posts 19

     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

Page 1 of 1 (6 items)