【发布时间】:2010-12-24 00:44:08
【问题描述】:
我有一个可用席位的 DataGrid,每个席位都有一个复选框,以便能够保留席位。在按钮单击事件中,如果单击 CheckBox,则将行的内容添加到 ArrayList,然后将 ArrayList 添加到会话,然后重定向到确认页面:
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"]);
}
在确认页面上,我想拆分这个数组并将其绑定到各自列中的另一个网格视图。
在确认页面上,存在一个会话,其中包含用管道分隔的三列,我正在努力将其拆分并将其绑定到确认网格。
请帮忙!
【问题讨论】:
标签: asp.net data-binding gridview multidimensional-array arraylist