我试图通过数据表绑定在 GrIdView 中显示图像,但它只是打印出纯文本而不是在 ie 中显示图片。
dt = 新数据表();
dt.Columns.Add("Status", typeof(string));
dt.Columns.Add("CRQ", typeof(String));
dt.Columns.Add("Summary", typeof(String));
dt.Columns.Add("Time", typeof(String));
Session["TempTable"] = dt;
GridView1.DataSource = dt;
//
//datat load
dt = (DataTable)Session["TempTable"]; // Fetching datatable from session
DataRow dr = dt.NewRow(); // Adding new row to datatable
dr[0] = "<img src='C:\\Users\\josephs\\Desktop\\red.jpg' style='border-width:0px'/>";
dr[1] = "CRQ000000000789";
dr[2] = "Test CRQ Summary, example data";
dr[3] = "WED 31/07/2013 16:00:00 PM";
dt.Rows.Add(dr);
DataRow dr2 = dt.NewRow(); // Adding new row to datatable
dr2[0] = "<img src='C:\\Users\\josephs\\Desktop\\red.jpg' style='border-width:0px'/>";
dr2[1] = "CRQ000000000889";
dr2[2] = "Test another CRQ, example data";
dr2[3] = "Tue 6/08/2013 14:00:00 PM";
dt.Rows.Add(dr2);
Session["TempTable"] = dt; // update datatable in session
GridView1.DataSource = dt; // updated datatable is now new datasource
GridView1.DataBind(); // calling databind on gridview