asp:gridview 中显示日期格式
boundfield中应该这样设置:
<asp:BoundField HeaderText="发表时间" DataField="PostTime" HtmlEncode=false DataFormatString="{0:yyyy-MM-dd}" >
模板中设置
<asp:TemplateField HeaderText ="日期">
<ItemTemplate>
<asp:TextBox ID="Date" runat="server" Text='<%# Bind("Date", "{0:d}") %>' BorderStyle="None"
HtmlEncode="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>