Results 1 to 2 of 2

Thread: Formatting Data in a Gridview?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Posts
    261

    Formatting Data in a Gridview?

    Currently I run a PROC that populates my Gridview. I know how to format the column widths, fonts etc, and I did some formatting on a date field as follows:

    <ItemTemplate>
    <asp:Label ID="Label2" runat="server" Font-Names="Arial" Font-Size="9pt" Text='<%# Bind("EFFECTIVE_DATE", "{0:d}") %>'></asp:Label>
    </ItemTemplate>

    but how do I format a phone number 5555551212 into (555) 555-1212,

    Similarly How do I format 2345.3321 into 2,345.33

  2. #2
    Fanatic Member
    Join Date
    May 2005
    Posts
    608

    Re: Formatting Data in a Gridview?

    Quote Originally Posted by seidel1
    phone number 5555551212 into (555) 555-1212
    Try this one: {0, "(000) 000-0000"}

    Quote Originally Posted by seidel1
    Similarly How do I format 2345.3321 into 2,345.33
    Try this one: {0, "0.00"}

    They should work. You will have to play a bit with the ", I don't have a VS nearby to try them out. Maybe it's without the " , but the format is like that.

    HTH
    HoraShadow
    I do like the reward system. If you find that my post was useful, rate it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width