Results 1 to 2 of 2

Thread: Formatting a value that is binded to a label.

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Formatting a value that is binded to a label.

    I have the following:
    VB Code:
    1. <asp:Label ID="lblDetails" Text='<%# DataBinder.Eval(container.DataItem, "DateFrom") %>' Font-Bold="True" Font-Size="8" Runat="server"/>
    What would I add to this to be able to format the date?

    Woof

  2. #2
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: Formatting a value that is binded to a label.

    Code:
    <asp:Label ID="lblDetails" Text='<%# DataBinder.Eval(container.DataItem, "DateFrom", "{0:D}") %>' Font-Bold="True" Font-Size="8" Runat="server"/>
    Where {0} is the format string. You can lookup various date formats here.

    HTH

    DJ

    If I have been helpful please rate my post. If I haven't tell me!

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