我有一个可用的座位DataGrid,每个都有一个复选框可以保留座位。在按钮单击事件,若点击复选框,我加入行的内容到一个ArrayList,然后重定向到确认页面之前添加的ArrayList到会话:将多维ArrayList绑定到Gridview
protected void Reserve_Click(object sender, EventArgs e)
{
{
ArrayList seatingArreaList = new ArrayList();
for (int i = 0; i < GridView1.Rows.Count; i++)
{
Guid SeatId = (Guid)GridView1.DataKeys[i][0];
CheckBox cbReserve = (CheckBox)GridView1.Rows[i].FindControl("cbReserve");
Label lblSection = (Label)GridView1.Rows[i].FindControl("lblSection");
Label lblRow = (Label)GridView1.Rows[i].FindControl("lblRow");
Label lblPrice = (Label)GridView1.Rows[i].FindControl("lblPrice");
if (cbReserve.Checked)
{
string tempRowInfo = lblSection.Text + "|" + lblRow.Text + "|" + lblPrice.Text;
seatingArreaList.Add(tempRowInfo);
}
}
// Add the selected seats to a session
Session["Seating"] = seatingArreaList;
}
Response.Redirect("Confirm.aspx?concertId=" + Request.QueryString["concertId"]);
}
在确认页面,我喜欢将这个数组分开并将它绑定到其各个列中的另一个gridview。
在确认页面上,存在一个会话,该会话有三个以管道分隔的列,我正努力将其拆分并将其绑定到确认网格。
请帮忙!
谢谢!有意义使用该页面上的数据表。我试图在确认页面上使用它,并将数组拆分成它。当然,现在我不需要阵列。谢谢 :-) – Neil 2009-12-07 15:01:33