Re: number format
- From: "Morten Wennevik" <MortenWennevik@xxxxxxxxxxx>
- Date: Wed, 08 Nov 2006 10:58:28 +0100
I couldn't get it to work either, and it may be because it is not identified as a number, but the other method should work.
On Tue, 07 Nov 2006 20:25:57 +0100, JFB <help@xxxxxxx> wrote:
Maybe because phone field is coming as varchar??
Any ideas
tks
JFB
"JFB" <help@xxxxxxx> wrote in message
news:%23DIBn8nAHHA.3560@xxxxxxxxxxxxxxxxxxxxxxx
Tks for you reply Morten,
<%# DataBinder.Eval(Container.DataItem, "cfax", "{0:###-###-####}") %>
I try the above code but it's not showing the format in my datagrid and I
don't get any errors...
Any ideas??
Rgds
JFB
"Morten Wennevik" <MortenWennevik@xxxxxxxxxxx> wrote in message
news:op.timwoeyfklbvpo@xxxxxxxx
Hi JFB,
I'm sure there is a better method, and using DataBinder.Eval you should be
able to format the number using something like
[C#]
<%# DataBinder.Eval(Container.DataItem, "cfax", "{0:###-###-####}") %>
However, I was unable to properly format the number that way so an
alternative method is to call a method that formats the number.
[C#]
<%# Format(DataBinder.Eval(Container.DataItem, "fax")) %>
Where Format is defined as
public string Format(object value)
{
long n = Convert.ToInt64(value);
return n.ToString("###-###-####");
}
On Tue, 07 Nov 2006 05:58:16 +0100, JFB <help@xxxxxxx> wrote:
Hi all,
How can I format a fax number as 888-333-444?
The number is coming from database as 8883334444
<ItemTemplate>
<%#container.dataItem("cfax")%>
</ItemTemplate>
Tks
JFB
--
Happy Coding!
Morten Wennevik [C# MVP]
--
Happy Coding!
Morten Wennevik [C# MVP]
.
- Follow-Ups:
- Re: number format
- From: JFB
- Re: number format
- From: JFB
- Re: number format
- References:
- number format
- From: JFB
- Re: number format
- From: Morten Wennevik
- Re: number format
- From: JFB
- Re: number format
- From: JFB
- number format
- Prev by Date: Re: Authentication Q - Cant use basic or windows
- Next by Date: Re: passing an arrayList to web service
- Previous by thread: Re: number format
- Next by thread: Re: number format
- Index(es):
Relevant Pages
|