Wenn man mit Bind ein Control an das SQL-Datasource gebunden hat, kann man diese auch mit dem Bind formatieren. Hier anhand eines Feldes von DateTime:
Normale Bindung
<asp:label ID="lblDatum2" runat="server" Text='<%# Bind("datum") %>'></asp:label> |
Ausgabe:
25.09.2006 01:03:54
Und Formatiert man es, wenn man z.B. keine Uhrzeit haben möchte:
<asp:label ID="lblDatum2" runat="server" Text='<%# Bind("datum", "{0:dd MM yyyy}") %>'></asp:label> |
Ausgabe:
25.09.2006