如:表date
字段:id DateTime
1 2012-2-12
2 2012-2-13
3 2012-3-5
4 2012-3-15
想要的结果是:2012-2
2012-3
请高手帮忙指点一下,上线等待
字段:id DateTime
1 2012-2-12
2 2012-2-13
3 2012-3-5
4 2012-3-15
想要的结果是:2012-2
2012-3
请高手帮忙指点一下,上线等待
调试欢乐多
</asp:BoundColumn>
<%# Eval("DateTime", "{0:yyyy-MM}") %>
或者在DataGrid的ItemDataBound事件中来处理
string dt = e.Item.Cells[日期列].Text;
dt = string.Format(dt,"{0:yyyy-MM}");
e.Item.Cells[日期列].Text = dt;
或在你在取数据时,用sql语句转换下,也行