User u = new User();
List<User> list = new List<User>();
u.Id = 1;
u.LoginName = "Mr.Han";
u.PassWord = "123456";
u.Name = "韩先生";
list.Add(u);
u.Id = 2;
u.LoginName = "Mr.HanHe";
u.PassWord = "123456";
u.Name = "赫先生";
list.Add(u);
gvUserInfo.DataSource = list;
}
-----------------------------------------------------
protected void gvUserInfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType==DataControlRowType.EmptyDataRow)
{
难道list绑定的不是数据行?
这你自己调试下,看下类型不就完了...
空行???因为不是空行呗。。。
你IF后面应该是判断非空再执行吧