Format Dates using Repeater Control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • charliewest

    Format Dates using Repeater Control

    Hello -

    I am pulling a datetime var from a dataset which is binded to a repeater
    control as follows:

    <%# DataBinder.Eval (Container.Data Item, "DateCreate d") %>

    The datetime value returns fine, but is not formated. How can i format this
    "inline code"? I am aware that this can be done using code-behind,
    specifically using the ItemDataBound event, but i'd like to learn how i can
    format dates, if possible, right in the above linem using the DataBinder
    method.

    Thanks,
  • Eliyahu Goldin

    #2
    Re: Format Dates using Repeater Control

    Try this:

    <%# System.Convert. ToDateTime (DataBinder.Eva l(Container.Dat aItem,
    "DateCreate d")) .ToString ("MM-dd-yyyy") %>

    Eliyahu

    "charliewes t" <charliewest@di scussions.micro soft.com> wrote in message
    news:A95BC5D7-B769-4B33-9DAE-C428D096DC0F@mi crosoft.com...[color=blue]
    > Hello -
    >
    > I am pulling a datetime var from a dataset which is binded to a repeater
    > control as follows:
    >
    > <%# DataBinder.Eval (Container.Data Item, "DateCreate d") %>
    >
    > The datetime value returns fine, but is not formated. How can i format[/color]
    this[color=blue]
    > "inline code"? I am aware that this can be done using code-behind,
    > specifically using the ItemDataBound event, but i'd like to learn how i[/color]
    can[color=blue]
    > format dates, if possible, right in the above linem using the DataBinder
    > method.
    >
    > Thanks,[/color]


    Comment

    Working...