我必須形成以音樂的各個流派數組列表,例如我將展示鄉村音樂:ArrayList的會議
public class CountryItemList
{
ArrayList CountryItems = new ArrayList();
protected void CountryBuy1_Click(object sender, ImageClickEventArgs e)
{
CountryItems.Add("Johnny Cash - I Walk The Line - $9");
}
protected void CountryBuy2_Click(object sender, ImageClickEventArgs e)
{
CountryItems.Add("Carrie Underwood - Blown Away - $9");
}
protected void CountryBuy3_Click(object sender, ImageClickEventArgs e)
{
CountryItems.Add("Keith Urban - The Story So Far - $9");
}
protected void CountryBuy5_Click(object sender, ImageClickEventArgs e)
{
CountryItems.Add("Taylor Swift - Red - $11");
}
protected void CountryBuy6_Click(object sender, ImageClickEventArgs e)
{
CountryItems.Add("Willie Nelson - Legend - $9");
}
}
}
每個購買按鈕被點擊,添加所選專輯到數組列表,從那時起,我希望將數組列表放入一個會話中,並將其帶到「購物車頁面」上的列表框中。我無法取出數組列表並將其轉入會話以轉到下一頁
你正在使用的ArrayList,而不是一般的收藏品之一的任何原因, 對於初學者? – 2013-04-04 19:40:23
您應該將'CountryItems'設爲'List'而不是'ArrayList'。 –
Lee
2013-04-04 19:40:39