1

这是GridView来自数据库的日期片段:

<asp:GridView ID="grid" runat="server" ...>
<asp:TemplateField HeaderText="Date">
<ItemTemplate> 
<asp:Label ID="dateLbl" runat="server" Text='<%# Bind("datevalue", "{0:dd MMM yy, ddd}") %>' />
</ItemTemplate>
...

日期看起来像07 Jan 13, Mon

我希望他们看起来像07 jan 13, mon

是否可以?

4

2 回答 2

1

行。唯一可用的选项是 CSS :)

<asp:Label ID="accdateLbl" runat="server" Text='<%# Bind("accvaluedate", "{0:dd MMM yy, ddd}") %>' CssClass="grid_date" />

.grid_date
{
    text-transform: lowercase;
}

现在它起作用了!

于 2013-01-10T04:51:28.030 回答
0

您可以在 gridview rowdatabound 事件中执行此操作:

protected void grid_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        Label dateLbl= (Label)e.Row.FindControl("dateLbl");
        string date=dataLbl.text.tolower();
        dateLBl.text=date;
    }          
}
于 2013-01-10T05:30:05.803 回答