How can I format a number column in a datagrid

Discussion in 'ASP .Net Datagrid Control' started by Arne, Jan 5, 2005.

  1. Arne

    Arne Guest

    I tried
    <asp:BoundColumn DataField="Logins" HeaderText="Logins"
    DataFormatString="{#,##.0}"></asp:BoundColumn>

    But it blows up.
    Is there a better way.
     
    Arne, Jan 5, 2005
    #1
    1. Advertising

  2. Eliyahu Goldin, Jan 6, 2005
    #2
    1. Advertising

  3. Arne

    Arne Guest

    Arne, Jan 6, 2005
    #3
  4. Then do it in code behind in either ItemDataBound or PreRender event. Get
    the cell value and apply formatting string of your choice in ToString
    method.
    For formatting strings look at
    http://msdn.microsoft.com/library/d...uide/html/cpconcustomnumericformatstrings.asp

    Eliyahu

    "Arne" <> wrote in message
    news:...
    > Eliyahu,
    > That didn't work for me.
    > Arne.
    >
    > "Eliyahu Goldin" wrote:
    >
    > >

    http://msdn.microsoft.com/library/d...rolsBoundColumnClassDataFormatStringTopic.asp
    > >
    > > Eliyahu
    > >
    > > "Arne" <> wrote in message
    > > news:...
    > > > I tried
    > > > <asp:BoundColumn DataField="Logins" HeaderText="Logins"
    > > > DataFormatString="{#,##.0}"></asp:BoundColumn>
    > > >
    > > > But it blows up.
    > > > Is there a better way.

    > >
    > >
    > >
     
    Eliyahu Goldin, Jan 6, 2005
    #4
  5. Arne

    Arne Guest

    Eliyahu,
    I had read the two above help files prior to posting my news item. After
    having read you first post a second time I came up with
    <asp:BoundColumn ItemStyle-HorizontalAlign="Right" DataField="Logins"
    HeaderText="Logins" DataFormatString="{0:N0}"></asp:BoundColumn>
    Arne

    "Eliyahu Goldin" wrote:

    > Then do it in code behind in either ItemDataBound or PreRender event. Get
    > the cell value and apply formatting string of your choice in ToString
    > method.
    > For formatting strings look at
    > http://msdn.microsoft.com/library/d...uide/html/cpconcustomnumericformatstrings.asp
    >
    > Eliyahu
    >
    > "Arne" <> wrote in message
    > news:...
    > > Eliyahu,
    > > That didn't work for me.
    > > Arne.
    > >
    > > "Eliyahu Goldin" wrote:
    > >
    > > >

    > http://msdn.microsoft.com/library/d...rolsBoundColumnClassDataFormatStringTopic.asp
    > > >
    > > > Eliyahu
    > > >
    > > > "Arne" <> wrote in message
    > > > news:...
    > > > > I tried
    > > > > <asp:BoundColumn DataField="Logins" HeaderText="Logins"
    > > > > DataFormatString="{#,##.0}"></asp:BoundColumn>
    > > > >
    > > > > But it blows up.
    > > > > Is there a better way.
    > > >
    > > >
    > > >

    >
    >
    >
     
    Arne, Jan 6, 2005
    #5
    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:
    1
    Views:
    710
    Joe Kesselman
    Sep 19, 2006
  2. Ken Starks
    Replies:
    4
    Views:
    354
    Ken Starks
    Jun 23, 2008
  3. Dave

    Format Phone Number String in Datagrid Column

    Dave, Dec 5, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    284
  4. Michael

    DataGrid Column number format

    Michael, Feb 4, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    207
    Michael
    Feb 7, 2005
  5. Fei Liu
    Replies:
    21
    Views:
    2,410
    John Bokma
    Dec 16, 2006
Loading...

Share This Page