我有 asp.net Gridview 控件,我将显示两列,一列是文本字段,另一列是图像字段。网格应该是可扩展的,并且应该显示所有图像。当我运行页面时,所有行图像都显示相同的图像。如何解决这个问题?
![网格查看结果][1]
我使用了 Imagehandler 文件
SqlConnection conn = new SqlConnection(connString);
string sqlsts = "SELECT us.name, us.image from userdetails as us where us.user_id in (select user_id from user_team where team_id in (select team_id from teaminfo where teamname='" + team + "'))";
SqlCommand command = new SqlCommand(sqlsts, conn);
conn.Open();
DataTable dtst = new DataTable();
SqlDataAdapter adp = new SqlDataAdapter(sqlsts, conn);
adp.Fill(dtst);
int roc = dtst.Rows.Count;
int coc = dtst.Columns.Count;
for (int i = 0; i < roc; i++)
{
Byte[] imageData = (Byte[])dtst.Rows[i]["image"];
context.Response.BinaryWrite((Byte[])dtst.Rows[i]["image"]);
context.Response.ContentType = "image/jpeg";
context.Response.End();
}