c# - How to fix date format in ASP .NET BoundField (DataFormatString)? -


i have dynamic boundfield (for detailsview) following code:

boundfield bf1 = new boundfield(); bf1.datafield = "createdate"; bf1.dataformatstring = "{0:dd/mm/yyyy}"; bf1.htmlencode = false; bf1.headertext = "sample header 2";  dv.fields.add(bf1); 

but somehow, still shows wrong format: 2013-04-29t18:15:20.270.

any way fix show "29/04/2013" instead? help.

you add dataformatstring="{0:m-dd-yyyy}" attribute bound field, this:

<asp:boundfield datafield="date" headertext="date" dataformatstring="{0:dd-m-yyyy}" /> 

source: cant format datetime using dataformatstring


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -