0
試圖採取什麼我已存儲添加一些的車到會話 然後將其轉移到另一個頁面以獲取一個GridView展現出來的一切,我已經添加到項目購物車會話。將其存儲爲對象會話。 -AddToCart需要的行的信息,並存儲在會話然後採取該會話對象,並顯示在另一頁上的網格圖。在會話狀態中存儲數據的購物車
藉此代碼是:
protected void GridViewDisplay_RowCommand(object sender,
GridViewCommandEventArgs e)
{
if (e.CommandName == "AddToCart")
{
object[] values;
DataTable orderTable;
// Retrieve the row index stored in the
// CommandArgument property.
int index = Convert.ToInt32(e.CommandArgument);
// Retrieve the row that contains the button
// from the Rows collection.
GridViewRow row = GridViewDisplay.Rows[index];
values = new Object[GridViewDisplay.Rows[0].Cells.Count];
for (int i = 0; i < GridViewDisplay.Rows[0].Cells.Count; i++)
{
values[i] = GridViewDisplay.Rows[0].Cells[i].Text;
}
orderTable = (DataTable)Session["OrderLine"];
orderTable.Rows.Add(values);
Session["OrderLine"] = orderTable;
}
}
那麼現在我試圖採取並將其存儲在一個會話這樣我就可以在另一個頁面上的網格視圖中顯示它。
你有什麼問題?什麼不行? –
我已經編輯好標題。請參閱:「[應該在其標題中包含」標籤「](http://meta.stackexchange.com/questions/19190/)」,其中的共識是「不,他們不應該」。 –
BTW你看任何的頁面右側的「相關」部分中的問題? –