0

我正在尝试使用 asp.net 将数据从一个页面传递到另一个页面

我在第二页写了这段代码

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;
            }
        }
    }
}

但它不起作用:(

请帮我找出错误:)

4

1 回答 1

2

将第一页中的复选框值保存在会话变量或 cookie 中,以便稍后在第二页中检索它们。

于 2013-03-26T12:18:15.950 回答