我有一個帶有條目,圖書標題和圖像的gridView。將gridview中的數據添加到會話變量中
如何在buttonField單擊事件中將選定的索引書標題和imageUrl分別添加到會話變量,以便我可以在不同的頁面上使用此信息。
我認爲像
string title = (string)GridView1.Rows[GridView1.SelectedIndex].DataItem["Title"];
Session["Title"] = title;
Response.Redirect("RateBook.aspx");
上面的代碼是不正確的。在按鈕點擊事件時,如何真正選擇所選行中的單個項目並將其添加到變量中?
Reagards