DataFormatString on boundcolumn not working

Discussion in 'ASP .Net Datagrid Control' started by Aaron, Apr 15, 2004.

  1. Aaron

    Aaron Guest

    Why doesn't the following code display a ten-digit number in the format
    123-456-7890?

    How can I format a ten-digit number as a telephone number?

    <asp:BoundColumn DataFormatString="{0:###-###-####}"
    DataField="Client_BPhone" HeaderText="BPhone">
    <ItemStyle Width="200px"></ItemStyle>
    </asp:BoundColumn>

    The width is working, I can change border sizes, but I am unable to format
    the string.

    Any help would be appreciated.

    Thanks,
    Aaron
     
    Aaron, Apr 15, 2004
    #1
    1. Advertising

  2. May by you need to try to use ItemTemplate.

    <%# (DataBinder.Eval(Container.DataItem,
    "ColName")).ToString("000-000-0000")%>

    Try to do it.

    "Aaron" <> wrote in message
    news:Xns94CCA7037FD44aaronjonharveycom1@207.46.248.16...
    > Why doesn't the following code display a ten-digit number in the format
    > 123-456-7890?
    >
    > How can I format a ten-digit number as a telephone number?
    >
    > <asp:BoundColumn DataFormatString="{0:###-###-####}"
    > DataField="Client_BPhone" HeaderText="BPhone">
    > <ItemStyle Width="200px"></ItemStyle>
    > </asp:BoundColumn>
    >
    > The width is working, I can change border sizes, but I am unable to format
    > the string.
    >
    > Any help would be appreciated.
    >
    > Thanks,
    > Aaron
     
    Michael Tkachev, Apr 16, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    414
  2. Gerhard Pretorius

    August CTP DataFormatString in Gridview not working

    Gerhard Pretorius, Sep 6, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,701
    Louis
    Sep 22, 2005
  3. Randall Parker
    Replies:
    1
    Views:
    6,152
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Dec 12, 2005
  4. mesut
    Replies:
    0
    Views:
    578
    mesut
    Jun 29, 2007
  5. Prasad Dannani

    Format Double Values using BoundColumn.DataFormatString

    Prasad Dannani, Jun 25, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    486
    Elton Wang
    Jun 27, 2005
Loading...

Share This Page