我有一個有兩個Web窗體的asp.net項目。我想將listbox3(這是主頁)的所有項目傳遞給統計頁面中的文本框。我嘗試下面的代碼,但沒有工作。如何將列表框的所有項目傳遞到另一個頁面中的文本框? ASP.NET
主頁:
protected void Button5_Click(object sender, EventArgs e)
{
Response.Redirect("Statistics.aspx?ListBox3");
}
統計數據頁
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox3.Text = ListBox3.Items;
}
}
我想你想枚舉的項目,像'foreach(var ListBox3.Items中的項目)TextBox3.Text = TextBox3 ==「」? TextBox3.Text + item.ToString():TextBox3.Text +「,」+ item.ToString();' –