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 6 3663
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 <he**@jfb.comwrote:
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]
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" <Mo************@hotmail.comwrote in message
news:op.timwoeyfklbvpo@tr024...
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 <he**@jfb.comwrote:
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]
Maybe because phone field is coming as varchar??
Any ideas
tks
JFB
"JFB" <he**@jfb.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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" <Mo************@hotmail.comwrote in message
news:op.timwoeyfklbvpo@tr024...
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 <he**@jfb.comwrote:
>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]
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 <he**@jfb.comwrote:
Maybe because phone field is coming as varchar??
Any ideas
tks
JFB
"JFB" <he**@jfb.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>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" <Mo************@hotmail.comwrote in message news:op.timwoeyfklbvpo@tr024... 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 <he**@jfb.comwrote:
>>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]
Tks for reply Morten,
Either way I couldn't made it to work.
I'm using vb.net function
Function Format(ByVal value As Object)
Dim n As Long = Convert.ToInt64(value)
Return n.ToString("###-###-####")
End Function
ERROR: System.FormatException: Input string was not in a correct format. at
System.Number.ParseInt64(String s, NumberStyles style, NumberFormatInfo
info) at System.String.System.IConvertible.ToInt64(IFormatP rovider provider)
at System.Convert.ToInt64(Object value)
Any Ideas??
Tks
JFB
"Morten Wennevik" <Mo************@hotmail.comwrote in message
news:op***************@tr024.bouvet.no...
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 <he**@jfb.comwrote:
Maybe because phone field is coming as varchar??
Any ideas
tks
JFB
"JFB" <he**@jfb.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>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" <Mo************@hotmail.comwrote in message news:op.timwoeyfklbvpo@tr024... 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 <he**@jfb.comwrote:
>>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]
Never Mine Morten.. it was the empty phone field.
Tks
JFB
"Morten Wennevik" <Mo************@hotmail.comwrote in message
news:op***************@tr024.bouvet.no...
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 <he**@jfb.comwrote:
Maybe because phone field is coming as varchar??
Any ideas
tks
JFB
"JFB" <he**@jfb.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>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" <Mo************@hotmail.comwrote in message news:op.timwoeyfklbvpo@tr024... 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 <he**@jfb.comwrote:
>>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] This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: martin.mrazek |
last post by:
Hello,
I wanted to install Number::Format module bud ended up with following
error message. Does anybody have any suggestion what the cause could
be?? Could that be due to presence of perldl in my...
|
by: Michelle Hillard |
last post by:
Hi guys, would appreciate if you can shed some light on this.
Sorry to be a pain, can you tell me what is wrong with the following:
for /F %%i in ('dir /b /on c:\bcp\pc*.txt') do bcp...
|
by: johkar |
last post by:
My XML and XSL is below. Also below is a textual representation of what I
want to get out of the XML with XSL. For each Extension node in XML, I am
only concerned with those nodes with...
|
by: Richard Haber |
last post by:
I am using format-number(-1234.56,'#,##0.00;(#,##0.00)') in a stylesheet
that works in every xsl processor (including MSXML2) except for the one in
..NET 1.1. I am expecting to see (1,234.56) as...
|
by: jm |
last post by:
I am trying to use datepart to get the real name of the month like
"April" or "APR" not just "4." I could not find it in the
documentation. Sorry. Thank you.
|
by: crowl |
last post by:
Hi all,
I want to have a number in a certain format. I took a look in the msdn
and was happy to find the format-number Function.
This works fine. But unfortunately, I can't find the format...
|
by: Kamaluokeakua |
last post by:
I have to write an application that deals with clients in multiple countries.
The addresses, phone numbers, country id and
currency information has to be stored into a database that allows for the...
|
by: Jovo Mirkovic |
last post by:
Hi,
I have to make a program which will generate 100,000 different ID
numbers (for example 2345-9341-0903-3432-3432 ...) It must be really
different, I meen it can not be a similar (like...
|
by: Dixie |
last post by:
I am appending some new fields to a table in vba and when I append a number
field with is a byte, it does not inherit any format. I want it to be the
General Number format, but it is blank. I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |