如何将复选框数据从一页传递到另一页 [英] How to pass checkbox data from one page to another
本文介绍了如何将复选框数据从一页传递到另一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用asp.net将数据从一页传递到另一页
I am trying to pass data from one page to another using asp.net
我在第二页中写了这段代码
I wrote this code in the second page
protected void Page_Load(object sender, EventArgs e)
{
Div1.InnerHtml = "I am here";
if (Page.PreviousPage != null)
{
CheckBoxList CheckBoxList1 =
(CheckBoxList)PreviousPage.FindControl("CheckBoxList1");
string section = "";
foreach (ListItem sec in CheckBoxList1.Items)
{
if (sec.Selected)
{
section += sec.Text + "<br />";
this.d.InnerHtml = section;
}
}
}
}
但不起作用:(
请帮助我找到错误:)
推荐答案
将第一页中的复选框值保存在会话变量或cookie中,以便稍后在第二页中可以从中检索它们.
Save the checkbox values from the first page in session variables or cookies, from where they can be retrieved later in the second page.
这篇关于如何将复选框数据从一页传递到另一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文