How to put an asp.net table's content into a session object?

  • Thread starter Jon via DotNetMonster.com
  • Start date
J

Jon via DotNetMonster.com

Hi all,

I have a asp.net table control placed on 'Calculator.aspx' page. The table
looks like this:

<div class="roiHTML" id="highAbandonRateSale" runat="server" visible="false"<asp:Table runat="server" ID="HARS_Table" >

<asp:TableRow><asp:TableCell><p>Average weekly Inbound calls offered
=</p></asp:TableCell><asp:TableCell>{INBOUND}</asp:TableCell></asp:TableRow>

<asp:TableRow><asp:TableCell><p>Average weekly abandon rate (%) =</p></asp:
TableCell><asp:TableCell>{ABANDON}</asp:TableCell></asp:TableRow>

</asp:Table>
</div>

In the 'Calculator.aspx.cs' code behind file I am trying to place the content
of the above table into a session object.
At the point I'm trying to do this the table has been created but is just
hidden from site. So I'm thinking something along the lines of:

Session["Session1"] = HARS_Table;
OR
Session["Session1"] = HARS_Table.InnerText;

I am way off in solving this simple task. Can someone please help me?
Thanks in advance.
 
S

sharmil

Hi,

To store the Content of table in session, you can do as below

To store the data of FirstRow alone
Session["Session1"]=Table1.Rows[0].Cells[0].Text;

To Store the entire table content , you need store that in single variable
string x="";
for(int i=0;i<Table1.Rows.Count;i++)
{
x+=Table1.Rows.Cells[0].Text ;
}
Session["Session1"]=x;

Thanx
Sharmila

Jon via DotNetMonster.com said:
Hi all,

I have a asp.net table control placed on 'Calculator.aspx' page. The
table
looks like this:

<div class="roiHTML" id="highAbandonRateSale" runat="server"
visible="false"<asp:Table runat="server" ID="HARS_Table" >

<asp:TableRow><asp:TableCell><p>Average weekly Inbound calls offered
=</p></asp:TableCell><asp:TableCell>{INBOUND}</asp:TableCell></asp:TableRow>

<asp:TableRow><asp:TableCell><p>Average weekly abandon rate (%)
=</p></asp:
TableCell><asp:TableCell>{ABANDON}</asp:TableCell></asp:TableRow>

</asp:Table>
</div>

In the 'Calculator.aspx.cs' code behind file I am trying to place the
content
of the above table into a session object.
At the point I'm trying to do this the table has been created but is just
hidden from site. So I'm thinking something along the lines of:

Session["Session1"] = HARS_Table;
OR
Session["Session1"] = HARS_Table.InnerText;

I am way off in solving this simple task. Can someone please help me?
Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top