Showing posts with label store. Show all posts
Showing posts with label store. Show all posts

Saturday, March 31, 2012

Trim trailing 0 from decimal place of number

Hi,

I am having difficulty trimming any traling 0's from my decimal numbers.
I store then in the database to 2 decimal places.
This means that when they come back to my application they still diply with
all the decimal places

eg

10.00 displays as 10.00
10.10 displays as 10.10

what I would like to achieve is the following

10.00 displays as 10
10.10 displays as 10.1

many thanks in advance

cheers

martin.string.Format("{0}",10);
string.Format("{0}",10.10);

should do the trick. Actually the above behavior should be the default
behavior...

+++ Rick --

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
-----------
Making waves on the Web

"martin" <Stuart_REMOVE_36@.yahoo.com> wrote in message
news:OXKXwadbEHA.2216@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I am having difficulty trimming any traling 0's from my decimal numbers.
> I store then in the database to 2 decimal places.
> This means that when they come back to my application they still diply
with
> all the decimal places
> eg
> 10.00 displays as 10.00
> 10.10 displays as 10.10
> what I would like to achieve is the following
> 10.00 displays as 10
> 10.10 displays as 10.1
> many thanks in advance
> cheers
> martin.

Trim trailing 0 from decimal place of number

Hi,
I am having difficulty trimming any traling 0's from my decimal numbers.
I store then in the database to 2 decimal places.
This means that when they come back to my application they still diply with
all the decimal places
eg
10.00 displays as 10.00
10.10 displays as 10.10
what I would like to achieve is the following
10.00 displays as 10
10.10 displays as 10.1
many thanks in advance
cheers
martin.string.Format("{0}",10);
string.Format("{0}",10.10);
should do the trick. Actually the above behavior should be the default
behavior...
+++ Rick --
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
--
Making waves on the Web
"martin" <Stuart_REMOVE_36@.yahoo.com> wrote in message
news:OXKXwadbEHA.2216@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I am having difficulty trimming any traling 0's from my decimal numbers.
> I store then in the database to 2 decimal places.
> This means that when they come back to my application they still diply
with
> all the decimal places
> eg
> 10.00 displays as 10.00
> 10.10 displays as 10.10
> what I would like to achieve is the following
> 10.00 displays as 10
> 10.10 displays as 10.1
> many thanks in advance
> cheers
> martin.
>

Tuesday, March 13, 2012

Trouble With UrlReferrer

I'm trying to store a session variable to store the filename of the page where the user was before the current one.

The reasoning is that I'm trying to store the value so that if a users session times out, I have the redirected to the logon page. Once they've logged back in I'd like to automatically take them back to the page where they were before.

I've tried using Session("ref")=Request.UrlReferrer to store the value. To test that I have the referring page I've created a label and assigned it the value of Session("Ref") by using lblReferrer.Text=Session("ref").

At first I was just getting a nothing where I exprected to see the referrer on the page. Today it's throwing an error saying can't convert a Uri to a String.

I've had a look at the documentation for Uri's but can't see a way to get just the referrers url.

Im I going about this the wrong way, or is it something basic I've missed?

Thanks
JasonSession("ref")=Request.UrlReferrer.ToString()
I did have .ToString() in the code at some stage, but I obviously in the wrong place.

In any case, you've solved my problem. Thanks for your help.
Jason