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

前端 未结 7 1730

I have a dynamic BoundField (for a DetailsView) with the following code:

BoundField bf1 = new BoundField();
bf1.DataField = \"CreateDate\";
bf1.DataFormatStr         


        
7条回答
  •  耶瑟儿~
    2020-12-30 22:04

    I had the same problem, only need to show shortdate (without the time), moreover it was needed to have multi-language settings, so depends of the language, show dd-mm-yyyy or mm-dd-yyyy.

    Finally using DataFormatString="{0:d}, all works fine and show only the date with culture format.

提交回复
热议问题