format number as a percent without rounding?

I am trying to display a number as a percentage.  From SQL, it is coming in as .99998.  So, when I do:

string

.Format("{0:P2}"

I am getting 100.00% displayed.  I don't want it to round up to 100 - I want it to display 99.99%.  Is this possible?

Thanks!

0
aozm
8/15/2006 2:50:19 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

1 Replies
725 Views

Similar Articles

[PageSpeed] 3

One solution (with 'd' being the number 0.99998)

string.Format("{0:P2}", Math.Truncate(d*10000) / 10000)
JasonF
A View Inside My Head
0
JasonFollas
8/15/2006 7:02:00 PM
Reply:

Similar Artilces:

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

windows forms in vb .net into web forms
we are creating a database driven website as part of our project. currently we have forms connecting to the database created in visual basic. these windows forms we need to convert into web forms which are asp .net compatible. can u give me an answer or show me a way. Hi, because of the difference in nature between web and win applications you'll need to reimplement at least the UI part. If you have a multitiered application in which the busines logic and data access are in different parts/assemblies you can reuse them. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Wor...

How do you incorporate a web page in a web form without IFrame
I would like to display a web page in my web form, but don't want to use frames or I frames. Can it be done with a label? If not then any suggestions and code would be appreciated. Thanks Please describe in more detail what you are trying to achieve. Frames and IFrames are for the purpose of rendering >1 html page in a single browser window. AFAIK there is no other way to achieve this purpose, but maybe you are trying to describe a different purpose? Basically it's a search page. The search term is picked up from a text box and then a URL is called. The URL is fed with the s...

.Net Web Form & Web Service Deployment
Hi all I have written some test web services and some web form applications and deployed them to my IIS. That's fine but I now want to deploy them to my real IIS server. I have created an msi for each but the problem is I seem to only be able to deploy to the default web site. Our default web site is turned off and instead we use several other sites. Does anybody happen to if Powerbuilder 11 supports non default web sites? If not do I need to hack the msi and if so can anybody suggest a suitable tool. I have Orca but it's not very friendly. Unless of course I knew exactly w...

Web forms and mobile web forms
Hey everyone, I am looking to develope a web site that depending on the device connecting to it, it will display a certain page. In this case im looking to create a web and wap version of the same project. I have the Web forms version finished using ASP.NET and C# and I am wondering how to create the mobile web form and incorporate it in the project. In the project folder, can I just add a mobile web??? But what about displaying device specific pages?? Cheers -Dudach Yes, you can add mobile web forms and controls to your Web Application project. No problem. For device/br...

How to Make Web Forms from other Web Forms
In putting together an ASP.NET application for a biz application, we have come to the point where there are three different types of basic forms which have, for the most part, been perfected. Now its is a matter of cloning those forms for various uses and modifying or adding code to suit the particular need. Copy and paste works OK, but there is a lot of changing of certain words, etc. Is there a way in ASP.NET to take these basic forms, turn them into classes or templates, create forms from them, then add or overwrite code? ? (Anybody who is a Vis Fox Pro programmer would know imme...

How to format a percent number as decimal using string.format in VB?
Hi, I have a GridView-Control with labels which contain numbers in percentformat, which are formatted in the RowDataBound-Event, but when I try to update the GridView i get the Invalid String format Exception because the labels are in the percentage Format like -27,5% but i need this number as double-value like 0.275. How can I convert the number from percentage to number? Any idea?  Thanks in forward,  Vlad  Dim str as string = percentlabel.Text ' Get rid of percentage sign str = str.Replace("%", "") ' Check if you can convert dim dbl as ...

For interrupting.web form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form
Web Form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form ! Because of my pool English, if you can't see , I will explain more ! ThanksGambler is the real life I guess you mean when form grows it also grow parent div element. This is normal. If you want div to stay fixed size and rather clip the form and maybe show a scrollbar, look at overflow property in CSS.Thanks------------------------------------------------------------This posting is provided "AS IS" with no warranties, and confers no ...

Web Form embedded in another Web Form
Hi,  I have programmed a Web Form which acts like a scientific calculator. I would like to embedd this calculator in the upper left hand corner of another accounting Web Form. I don't want to host the calculator on the same server as the accounting page. I.e. I want them to have distinct URLs. Classically, I would do this using frames, but is there a better way using ASP? Is there some sort of Panel which can display the webpage at a specific URL which I can just drag onto my accounting Web Form? Thanks,  P1000   Frames are the only way to embed a webform inside ano...

.Net Web Forms
what is the best way to create a multi-page web insurance quote form (similar to Geico) that will insert information into a database? The examples i've seen show one form with a submit button at the bottom. I need to break this form into at least three different aspx or ascx pages. Thanks for the help. I did something similiar since I have like 7 sections to an application. The way I did it was by using the asp:panel control. When the user finished one section and clicks a button it inputs the data into the database and hides the 1st panel and shows the next one. HTH...

Rounding numbers in .NET
Hi, I take in a value like 17499.99 in my app. I want to round this up to the nearest thousand So above should be 18000. Even if I have a value like 17001 I want to round up to 18000. Anyone know how I can do this? I have tried using the Math class but it does not do this for me. If i round 17499.99 using Math.Round it gives me 17500 but I want to get 18000. Once it is anyway over 17000 I want to round it to 18000. Thanks, C. Hey COG, Try something like this: 1) Take the number and divide by 1000 2) Round that number to the nearest integer (using Math.Cei...

Format numbers as a percent
I just discovered a new trick for automatically formatting a number as a percentage. I'm posting the link here so it can be Googled in the future. http://blogs.aspadvice.com/crystal/archive/2004/11/30/1949.aspx Brian Bischof www.CrystalReportsBook.com ...

Formatting Web forms
hi, Could someone tell me what is the best way to format textboxes,lables etc on the webform. When I open and close the form they loose the formatting. Please help. CSS is a good thing for your issue. I'm busy and do not have the time to explain it but should be very easy to find in a search engine. CSS = Cascading Style Sheets Are you using VS.NET, that's a part of the editor. See this post for a possible workaround. BrianBrian"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires...

Could PB .NET Web Form POST security Information to others web page??
This is a multi-part message in MIME format. ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable Hi,=20 Have anyone came across the requesion to POST security informations from = PB .NET web form web page to other web site?? I have tried many datys, Could any kind man give me some suggessions?? thanks & Best regards Leon ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML P...

Web resources about - format number as a percent without rounding? - asp.net.web-forms

Rounding - Wikipedia, the free encyclopedia
This article is about numerical rounding. For lip-rounding in phonetics, see Labialisation . For other uses, see Rounding (disambiguation) . ...

Decimal Rounding on the App Store on iTunes
Get Decimal Rounding on the App Store. See screenshots and ratings, and read customer reviews.

Christmas in summer: Rounding up Gadgety Goodness in NYC
Check out the newest gadgets on display in the world of consumer electronics

Christmas in summer: Rounding up Gadgety Goodness in NYC
The temperatures were hovering near 80, but there definitely was a "Christmas in June" vibe at last night's Digital Experience in New York, sponsored ...

'New Hitler' Gaddafi rounding up opponents
The son of a retired Libyan academic fears the worst for his father and three brothers after they are kidnapped by Moamar Gaddafi's forces in ...

Bell, Telus Face Lawsuit Over Rounding Up Calls To Next Full Minute
TORONTO An Ontario court has certified class action lawsuits against Telus and Bell over the practice of rounding up calls to the next full minute. Lawyers ...

Rounding Out Advertising Week With Your Burning Questions
Ad Age Publisher Allison Arden led an Advertising Week panel with four marketers at Nasdaq MarketSite today, using crowd-curated marketing questions ...

Rounding Up the Apple Rumors Ahead of WWDC
Apple will kick off its annual Worldwide Developers Conference with a Monday keynote address from CEO Tim Cook, and there’s no shortage of prognostications ...

AnandTech - AMD Radeon HD 7870 GHz Edition & Radeon HD 7850 Review: Rounding Out Southern Islands
In 2009-2010, AMD launched the entire 4 chip Evergreen series in 6 months. By previous standards this was a quick pace for a new design, especially ...

Nobody Is Rounding Up Jews In Ukraine
Donetsk Chief rabbi: leaflet distributed by separatists asking Jews to register, calls it a "provocation" #Ukraine http://t.co/h6xXjTERaH&quot ...

Resources last updated: 1/11/2016 12:41:17 AM