Gridview TemplateField 显示日期
2010-05-14 09:21
183 查看
方法一:
代码
protected void xxxxx_RowDataBound(object sender, GridViewRowEventArgs e)
{
InsusDateTimeUtility objInsusDateTimeUtility = new InsusDateTimeUtility();
DataRowView drv = (DataRowView)e.Row.DataItem;
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.FindControl("LabelInspectionDate") != null)
{
Label labelInspectionDate = (Label)e.Row.FindControl("LabelInspectionDate");
labelInspectionDate.Text = objInsusDateTimeUtility.GetDateTime(drv["InspectionDate"], "yyyy-MM-dd");
}
}
}
代码
protected void xxxxx_RowDataBound(object sender, GridViewRowEventArgs e)
{
InsusDateTimeUtility objInsusDateTimeUtility = new InsusDateTimeUtility();
DataRowView drv = (DataRowView)e.Row.DataItem;
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.FindControl("LabelInspectionDate") != null)
{
Label labelInspectionDate = (Label)e.Row.FindControl("LabelInspectionDate");
labelInspectionDate.Text = objInsusDateTimeUtility.GetDateTime(drv["InspectionDate"], "yyyy-MM-dd");
}
}
}
相关文章推荐
- GridView自定义TemplateField————把同一行中的内容分成多行显示///////若行数太多,则分行显示
- 获取GRIDVIEW中的TemplateField显示的文本值
- 获取GRIDVIEW中的TemplateField显示的文本值
- gridview列 数字、货币和日期 显示格式
- GridView中出现“TemplateField 上不支持回调,因为某些控件不能在回调中正确更新。”的解决方法
- ASP.NET2.0中的GRIDVIEW控件在使用TemplateField中的LinkButton时如何在RowCommand事件中找到当前行index的方法
- gridview列 数字、货币和日期 显示格式
- ASP.NET GridView_第四篇_控件和HTML标记的容器 TemplateField 模板列
- gridview列 数字、货币和日期 显示格式
- GridView列数字、货币和日期的显示格式
- GridView 中的日期以一定格式显示
- GridView中数字、货币和日期的显示格式
- gridview中的日期总是显示到时分秒,为了让只其显示年月日,采用如下代码:
- gridview使用TemplateField中的LinkButton时如何在RowCommand事件中找到当前行index的方法
- ASP.NET 2.0数据教程之十二:在GridView控件中使用TemplateField(转)
- GridView、Repeater等数据控件列数字、货币和日期的显示格式 .
- gridview列 数字、货币和日期 显示格式
- GridView列数字、货币和日期的显示格式
- GridView列数字、货币和日期的显示格式
- GridView1使用Label ,TextBox 及隐藏Label,让TextBox使用日期控件EditItemTemplate效果,并后台获其取值,