简体   繁体   中英

how to store htmltable into session variable

i have a html table which i want to pass to another page using session variable,how can it be done? I have tried this

Session["sumtable"] = (HtmlTable)htab;

Its not working...

On the other page .aspx

<table id="tblsum" runat="server"></table>

.cs

if (Session["sumtable"] != null)
                {
                    tblsum = (HtmlTable)Session["sumtable"];
                }

Try this

//Page Source
            Session["tbl"] = dt.Rows; // table id = td
            Response.Redirect("WebForm4.aspx");

            // page Destination
            HtmlTableRowCollection tr = (HtmlTableRowCollection)Session["tbl"];

            foreach (HtmlTableRow t in tr)
            {
                dt.Rows.Add(t); // table id = td
            }  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM