gridview RowDataBound事件绑定事只绑定第一行数据或者隔一行绑定,什么情况?
程序代码:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string userid = e.Row.Cells[1].Text.ToString(); string sql = "select * from tb_user where id = " + userid; if (co.execSQL(sql)) { SqlDataReader reader = co.getRow(sql); reader.Read(); e.Row.Cells[1].Text = reader["name"].ToString(); } }
[ 本帖最后由 a8854827 于 2013-10-24 00:52 编辑 ]