如何从显示日期显示时,在GridView停止的时间? [英] How can I stop the time from displaying in a GridView when displaying a date?
问题描述
我有我的工作在一个Web应用程序(ASP.NET 2.0和C#)。在这里面,我有一个GridView,从Oracle数据库获取数据。一些我需要显示的数据是日期。但是,当我在GridView中显示的日期如下:
2009-04-02 00:00:00
块引用>我preFER他们不显示时间。我使用的是codebehind来获取数据,所以我不能手动更改的gridview的领域。这是所有的code为我的GridView的:
< ASP:GridView控件ID =网格=服务器EmptyDataText =没有数据记录,显示 >< / ASP:GridView的>
如何停止的时候无法显示?
解决方案您可以应用
dataformatstring
在GridView控件
列,只显示日期。要得到它的工作,你必须确保
HTMLEn code
设置为假
。<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.dataformatstring.aspx\"相对=nofollow>更多
I have a web application that I am working on(ASP.NET 2.0 & C#). In it, I have a gridview that gets data from an Oracle Database. Some of the data that I need to display is dates. But when the dates in my gridview show like this:
2009-04-02 00:00:00
I'd prefer they show without the time. I'm using the codebehind to get the data, so I cant alter the fields of the gridview manually. This is all the code for my gridview :
<asp:GridView ID="Grid" runat="server" EmptyDataText="There are no data records to display." ></asp:GridView>
How do I stop the time from displaying?
解决方案You can apply a
dataformatstring
in thegridview
column to only show the date.To get it to work you must make sure that
HTMLEncode
is set tofalse
.这篇关于如何从显示日期显示时,在GridView停止的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!