我上傳了一張圖片並將Url(uploadedImage.FileName)添加到數據庫中。然後,我將一個gridview綁定到dataBase,並將DataImageUrl字段設置爲存儲uploadedImage.FileName的數據庫的PictureUrl列,因此圖像顯示在gridview中(仍然在控制尺寸上掙扎了一下)。將圖像存儲到會話變量中
我只想知道如何將這個圖像信息添加到會話變量,以便它可以顯示在不同的頁面上。 這是我迄今爲止所做的(我還添加了一個會話[「標題」],這很容易,因爲它只顯示其他頁面上的文本值)。
如果(e.CommandName ==「addToSession」) {
//get the row index stored in the CommandArgument property
int index = Convert.ToInt32(e.CommandArgument);
//get the gridview row where the command is raised
GridViewRow selectedRow = ((GridView)e.CommandSource).Rows[index];
//values stored in the text propert of the cells
string title = selectedRow.Cells[1].Text;
string pictureUrl = selectedRow.Cells[3].Text; ???????
//set the sesion variable ["Title"] to the title
Session["Title"] = title;
//this is where i am experiencing some problems
Session["ImageID"] = pictureUrl; ???????
Response.Redirect("RateBook.aspx");
}
我應該添加其他頁面上的圖像按鈕,並嘗試將其綁定到GridView也許是的ImageField?
關於