tulkas85
tulkas85

Reputation: 1103

Asp.Net set format text for DropDownList

I have a dropdownlist that display DateTime object in default format.

I want that visible date is in format "ddd dd/MM/yyyy HH:mm" like : Mon 13/08/2013 21:30

Using this code :

ddl_dat.DataTextFormatString="{0:dd/MM/yyyy}";

it work but show me only : 13/08/2013

Using instead

ddl_dat.DataTextFormatString="{ddd 0:dd/MM/yyyy HH:mm}";

I have a FormatException

Upvotes: 1

Views: 1192

Answers (2)

Manish Sharma
Manish Sharma

Reputation: 2426

try this,

<asp:DropDownList id="yourList" runat="server" dataTextFormatString="{0: ddd d/MM/yyyy HH:mm}"/>

Upvotes: 0

donstack
donstack

Reputation: 2715

try this one:

ddl_dat.DataTextFormatString="{0: ddd d/MM/yyyy HH:mm}";

Upvotes: 3

Related Questions