开发者

Date formatting issue in GridView in asp.net

here is a Date column in GridView in my .net application.

<asp:BoundField DataField="TestDate" HeaderText="Date" DataFormatString="{0:dd/MM/yyyy}">
</asp:BoundField>

date displaying properly on my pc in given format :

23/03/2011
开发者_开发百科

but on test server it displaying in the following format:

3/23/2011 5:19:18 PM

which is incorrect.

Does anyone know how to resolve it?


Try this

 <asp:boundfield datafield="Your_Date_Column" dataformatstring="{0:MMMM d, yyyy}" htmlencode="false" />

Why htmlencode requires is

HTML-encoding field values helps to prevent cross-site scripting attacks and malicious content from being displayed. This property should be enabled whenever possible.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜