c#.net语句e.Row.RowType == DataControlRowType.DataRow是什么含义?
事件语句
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[3].Text = Convert.ToDateTime(e.Row.Cells[3].Text).ToShortDateString();
}
}
中
e.Row.RowType 是什么意思?
DataControlRowType.DataRow又表示什么?
e.Row.RowType 是指当前行的类型
DataControlRowType 是GridView的行的类型集合 其中的DataRow是数据绑定行
这个判断语句的意思就是判断当前行是不是数据绑定行
是绑定时用来过滤标题行和序号行等等非数据绑定行的
评论