试图了解与会话转流列表框中的值/项。 [英] Trying to understand transfering listbox values/items with sessions.
本文介绍了试图了解与会话转流列表框中的值/项。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的第一页我有两个列表框的电影和零食
On my first page I have two listboxes for Movies and Snacks
他们被称为 lbDisplay 的电影和 lbSelected 的零食。
我目前使用的有以下code一个转到购物车功能:
I am currently using a "Go to cart" function that has the following code:
Session["lbSelectedMovies"] = lbDisplay;
Session["lbSelectedSnacks"] = lbSelected;
Response.Redirect("RingU6POSReview.aspx");
重定向的页面上的两个列表框,我想给定的值转移到被称为 lbRvMovies 和 lbRvSnacks
该页面被称为 RingU6POSReview.aspx
谁能帮助我了解如何当我重定向客户传递价值?
Can anyone help me understand how to transfer the values when I redirect the customer?
推荐答案
在第2页说,你有另一个列表框(说ListBox1中)到要分配传递的值,然后使用FOLL的任何一个。 3种方法:
On the 2nd page say you have another list box (say ListBox1) to which you want to assign the passed values then use the any one of the foll. 3 methods:
ListBox ListBox1 = null;
ListBox1 = Session["lbSelectedMovies"] as ListBox;
或
ListBox ListBox1 = new ListBox();
foreach (ListItem Item in ((ListBox)(Session["lbSelectedMovies"])).Items)
{
ListBox1.Items.Add(new ListItem(Item.Text, Item.Value));
}
或
ListBox1.Items.AddRange((ListItem[])Session["lbSelectedMovies"]);
这篇关于试图了解与会话转流列表框中的值/项。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文