473,568 Members | 2,964 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing Session Variable Information To a Table

I have a four page form. Pages 1-3 stores there information in a session
variables. Page four is reached (a final review page) and then the
information will be written to the SQL server.

When I tried to enter some code in the HTML table by hand so I could get it
to show up in the right place. For example I use this code in the HTML
table:

<td><%=sessionv ar1%><%=session var2%></td>

Compile and run, when I get to the 4th page it says that sessionvar1 has not
been declared. Can I use session variables this way to display the
information?
Nov 17 '05 #1
5 1979
Justin, thanks for your reply.

I tried doing that way. The only problem doing it this way is this
information is coming from a series of check boxes on the first page. So it
will vary the amount of information that will be displayed on the summary
page. If I put all these label fields in that cell of the table, it will
space it out and leave a huge gap. What I was looking to for was something
that would allow the cell to conform to the amount of information that will
be presented.

Thanks again.
"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:uh******** ******@tk2msftn gp13.phx.gbl...
Michelle,

No, that isn't the proper way to use them.

I would put a label into the table and then when you get to the page set the text of the label = to the session variable.

(e.g.

Label1.Text = CType(Session(" var1"), String)

)

Sincerely,
--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Michelle A." <me@me.com> wrote in message
news:uF******** ******@TK2MSFTN GP12.phx.gbl...
I have a four page form. Pages 1-3 stores there information in a session variables. Page four is reached (a final review page) and then the
information will be written to the SQL server.

When I tried to enter some code in the HTML table by hand so I could get

it
to show up in the right place. For example I use this code in the HTML
table:

<td><%=sessionv ar1%><%=session var2%></td>

Compile and run, when I get to the 4th page it says that sessionvar1 has

not
been declared. Can I use session variables this way to display the
information?


Nov 17 '05 #2
concatenate
"Michelle A." <me@me.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Justin, thanks for your reply.

I tried doing that way. The only problem doing it this way is this
information is coming from a series of check boxes on the first page. So it will vary the amount of information that will be displayed on the summary
page. If I put all these label fields in that cell of the table, it will
space it out and leave a huge gap. What I was looking to for was something that would allow the cell to conform to the amount of information that will be presented.

Thanks again.
"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:uh******** ******@tk2msftn gp13.phx.gbl...
Michelle,

No, that isn't the proper way to use them.

I would put a label into the table and then when you get to the page set

the
text of the label = to the session variable.

(e.g.

Label1.Text = CType(Session(" var1"), String)

)

Sincerely,
--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Michelle A." <me@me.com> wrote in message
news:uF******** ******@TK2MSFTN GP12.phx.gbl...
I have a four page form. Pages 1-3 stores there information in a session variables. Page four is reached (a final review page) and then the
information will be written to the SQL server.

When I tried to enter some code in the HTML table by hand so I could get
it
to show up in the right place. For example I use this code in the
HTML table:

<td><%=sessionv ar1%><%=session var2%></td>

Compile and run, when I get to the 4th page it says that sessionvar1

has not
been declared. Can I use session variables this way to display the
information?



Nov 17 '05 #3
Let me add some code:

Here is the code behind page: (I know this might not be the most efficent
way )

An if statement checks what check boxes were checked and displays them to
the correct label in the table:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
If Session("Giftto ag") Then
Me.Label1.Text = "College of Agriculture"
Else
Me.Label1.Text = ""
End If
If Session("Giftto bus") Then
Me.Label2.Text = "College of Buisness "
Else
Me.Label2.Text = ""
End If
If Session("Giftto design") Then
Me.Label3.Text = "College of Design"
Else
Me.Label3.Text = ""
End If
If Session("Giftto edu") Then
Me.Label4.Text = "College of Education"
Else
Me.Label4.Text = ""
End If
If Session("Giftto engin") Then
Me.Label5.Text = "College of Engineering"
Else
Me.Label5.Text = ""
End If
If Session("Giftto fcs") Then
Me.Label6.Text = "College of Family and Consumer Sciences"
Else
Me.Label6.Text = ""
End If
If Session("Giftto las") Then
Me.Label7.Text = "College of Liberal Arts and Sciences"
Else
Me.Label7.Text = ""
End If
If Session("Giftto vetmed") Then
Me.Label8.Text = "College of Veterinary Medicine"
Else
Me.Label8.Text = ""
End If
If Session("Giftto library") Then
Me.Label9.Text = "University Library"
Else
Me.Label9.Text = ""
End If
If Session("Giftto morrill") Then
Me.Label10().Te xt = "Morrill Hall Restoration Project"
Else
Me.Label10.Text = ""
End If
If Session("Giftto area") Then
Me.Label11().Te xt = "Area of Greatest Need"
Else
Me.Label11.Text = ""
End If

Me.Label12.Text = Session("Giftto other")
Me.Label13.Text = Session("GiftAm ount")
End Sub
Here is the HTML section where the information is displayed in the table.

<tr>
<td style="WIDTH: 268px; HEIGHT: 21px" align="left">Gi ft
Desgination(s): </td>
<td align="center" style="HEIGHT: 21px">

<asp:Label id="Label1" runat="server"> Label</asp:Label>

<asp:label id="Label2" runat="server"> Label</asp:label>
<asp:label id="Label3" runat="server"> Label</asp:label>
<asp:label id="Label4" runat="server"> Label</asp:label>
<asp:label id="Label5" runat="server"> Label</asp:label>
<asp:label id="Label6" runat="server"> Label</asp:label>
<asp:label id="Label7" runat="server"> Label</asp:label>
<asp:label id="Label8" runat="server"> Label</asp:label>
<asp:Label id="Label9" runat="server"> Label</asp:Label>
<asp:Label id="Label10" runat="server"> Label</asp:Label>
<asp:Label id="Label11" runat="server"> Label</asp:Label>
<asp:Label id="Label12" runat="server"> Label</asp:Label>
</td>
</tr>

"Michelle A." <me@me.com> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
Would I add that in the HTML code or in the Code behind pages..?
"Jason (MFT1)" <us****@newsgro up.pls> wrote in message
news:eQ******** ********@TK2MSF TNGP09.phx.gbl. ..
concatenate
"Michelle A." <me@me.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Justin, thanks for your reply.

I tried doing that way. The only problem doing it this way is this
information is coming from a series of check boxes on the first page. So
it
will vary the amount of information that will be displayed on the summary page. If I put all these label fields in that cell of the table, it will space it out and leave a huge gap. What I was looking to for was

something
that would allow the cell to conform to the amount of information that

will
be presented.

Thanks again.
"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:uh******** ******@tk2msftn gp13.phx.gbl...
> Michelle,
>
> No, that isn't the proper way to use them.
>
> I would put a label into the table and then when you get to the page set the
> text of the label = to the session variable.
>
> (e.g.
>
> Label1.Text = CType(Session(" var1"), String)
>
> )
>
> Sincerely,
>
>
> --
> S. Justin Gengo, MCP
> Web Developer
>
> Free code library at:
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzche
>
>
> "Michelle A." <me@me.com> wrote in message
> news:uF******** ******@TK2MSFTN GP12.phx.gbl...
> > I have a four page form. Pages 1-3 stores there information in a
session
> > variables. Page four is reached (a final review page) and then the > > information will be written to the SQL server.
> >
> > When I tried to enter some code in the HTML table by hand so I could get
> it
> > to show up in the right place. For example I use this code in the

HTML
> > table:
> >
> > <td><%=sessionv ar1%><%=session var2%></td>
> >
> > Compile and run, when I get to the 4th page it says that
sessionvar1 has
> not
> > been declared. Can I use session variables this way to display

the > > information?
> >
> >
>
>



Nov 17 '05 #4
I usually use the code behind but it doesn't make much difference I don't
suppose. I also use a delimiter which makes it easier to use the resultant
string later.

HTH
"Michelle A." <me@me.com> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
Would I add that in the HTML code or in the Code behind pages..?
"Jason (MFT1)" <us****@newsgro up.pls> wrote in message
news:eQ******** ********@TK2MSF TNGP09.phx.gbl. ..
concatenate
"Michelle A." <me@me.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Justin, thanks for your reply.

I tried doing that way. The only problem doing it this way is this
information is coming from a series of check boxes on the first page. So
it
will vary the amount of information that will be displayed on the summary page. If I put all these label fields in that cell of the table, it will space it out and leave a huge gap. What I was looking to for was

something
that would allow the cell to conform to the amount of information that

will
be presented.

Thanks again.
"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:uh******** ******@tk2msftn gp13.phx.gbl...
> Michelle,
>
> No, that isn't the proper way to use them.
>
> I would put a label into the table and then when you get to the page set the
> text of the label = to the session variable.
>
> (e.g.
>
> Label1.Text = CType(Session(" var1"), String)
>
> )
>
> Sincerely,
>
>
> --
> S. Justin Gengo, MCP
> Web Developer
>
> Free code library at:
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzche
>
>
> "Michelle A." <me@me.com> wrote in message
> news:uF******** ******@TK2MSFTN GP12.phx.gbl...
> > I have a four page form. Pages 1-3 stores there information in a
session
> > variables. Page four is reached (a final review page) and then the > > information will be written to the SQL server.
> >
> > When I tried to enter some code in the HTML table by hand so I could get
> it
> > to show up in the right place. For example I use this code in the

HTML
> > table:
> >
> > <td><%=sessionv ar1%><%=session var2%></td>
> >
> > Compile and run, when I get to the 4th page it says that
sessionvar1 has
> not
> > been declared. Can I use session variables this way to display

the > > information?
> >
> >
>
>



Nov 17 '05 #5
Michelle,

I understand you don't know how many checkboxes values will need to be
displayed.

Do you know how to add labels to a control dynamically? I think this would
be the best solution.

Put a placeholder control in the table cell. Then dynamically create a label
for every check box that's checked and then add that label to the
placeholder.

'---Sample Code

If Session("Giftto ag") Then
Call AddLabel("Colle ge of Agriculture")
End If

If Session("Giftto bus") Then
Call AddLabel("Colle ge of Buisness ")
End If

If Session("Giftto design") Then
Call AddLabel("Colle ge of Design")
End If

'---This subroutine adds a label to the placeholder
Private Sub AddLabel(ByVal textToAdd As String)
Dim Label As New Label
Label.Text = textToAdd
Placeholder1.Co ntrols.Add(Labe l)

Dim Literal As New LiteralControl
Literal.Text = "<br>"
Placeholder1.Co ntrols.Add(Lite ral)
End Sub
Sincerely,
--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Michelle A." <me@me.com> wrote in message
news:%2******** **********@tk2m sftngp13.phx.gb l...
Let me add some code:

Here is the code behind page: (I know this might not be the most efficent
way )

An if statement checks what check boxes were checked and displays them to
the correct label in the table:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
If Session("Giftto ag") Then
Me.Label1.Text = "College of Agriculture"
Else
Me.Label1.Text = ""
End If
If Session("Giftto bus") Then
Me.Label2.Text = "College of Buisness "
Else
Me.Label2.Text = ""
End If
If Session("Giftto design") Then
Me.Label3.Text = "College of Design"
Else
Me.Label3.Text = ""
End If
If Session("Giftto edu") Then
Me.Label4.Text = "College of Education"
Else
Me.Label4.Text = ""
End If
If Session("Giftto engin") Then
Me.Label5.Text = "College of Engineering"
Else
Me.Label5.Text = ""
End If
If Session("Giftto fcs") Then
Me.Label6.Text = "College of Family and Consumer Sciences"
Else
Me.Label6.Text = ""
End If
If Session("Giftto las") Then
Me.Label7.Text = "College of Liberal Arts and Sciences"
Else
Me.Label7.Text = ""
End If
If Session("Giftto vetmed") Then
Me.Label8.Text = "College of Veterinary Medicine"
Else
Me.Label8.Text = ""
End If
If Session("Giftto library") Then
Me.Label9.Text = "University Library"
Else
Me.Label9.Text = ""
End If
If Session("Giftto morrill") Then
Me.Label10().Te xt = "Morrill Hall Restoration Project"
Else
Me.Label10.Text = ""
End If
If Session("Giftto area") Then
Me.Label11().Te xt = "Area of Greatest Need"
Else
Me.Label11.Text = ""
End If

Me.Label12.Text = Session("Giftto other")
Me.Label13.Text = Session("GiftAm ount")
End Sub
Here is the HTML section where the information is displayed in the table.

<tr>
<td style="WIDTH: 268px; HEIGHT: 21px" align="left">Gi ft
Desgination(s): </td>
<td align="center" style="HEIGHT: 21px">

<asp:Label id="Label1" runat="server"> Label</asp:Label>

<asp:label id="Label2" runat="server"> Label</asp:label>
<asp:label id="Label3" runat="server"> Label</asp:label>
<asp:label id="Label4" runat="server"> Label</asp:label>
<asp:label id="Label5" runat="server"> Label</asp:label>
<asp:label id="Label6" runat="server"> Label</asp:label>
<asp:label id="Label7" runat="server"> Label</asp:label>
<asp:label id="Label8" runat="server"> Label</asp:label>
<asp:Label id="Label9" runat="server"> Label</asp:Label>
<asp:Label id="Label10" runat="server"> Label</asp:Label>
<asp:Label id="Label11" runat="server"> Label</asp:Label>
<asp:Label id="Label12" runat="server"> Label</asp:Label>
</td>
</tr>

"Michelle A." <me@me.com> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
Would I add that in the HTML code or in the Code behind pages..?
"Jason (MFT1)" <us****@newsgro up.pls> wrote in message
news:eQ******** ********@TK2MSF TNGP09.phx.gbl. ..
concatenate
"Michelle A." <me@me.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
> Justin, thanks for your reply.
>
> I tried doing that way. The only problem doing it this way is this
> information is coming from a series of check boxes on the first page.
So
it
> will vary the amount of information that will be displayed on the

summary
> page. If I put all these label fields in that cell of the table, it

will
> space it out and leave a huge gap. What I was looking to for was
something
> that would allow the cell to conform to the amount of information
that will
> be presented.
>
> Thanks again.
>
>
> "S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
> news:uh******** ******@tk2msftn gp13.phx.gbl...
> > Michelle,
> >
> > No, that isn't the proper way to use them.
> >
> > I would put a label into the table and then when you get to the page
set
> the
> > text of the label = to the session variable.
> >
> > (e.g.
> >
> > Label1.Text = CType(Session(" var1"), String)
> >
> > )
> >
> > Sincerely,
> >
> >
> > --
> > S. Justin Gengo, MCP
> > Web Developer
> >
> > Free code library at:
> > www.aboutfortunate.com
> >
> > "Out of chaos comes order."
> > Nietzche
> >
> >
> > "Michelle A." <me@me.com> wrote in message
> > news:uF******** ******@TK2MSFTN GP12.phx.gbl...
> > > I have a four page form. Pages 1-3 stores there information in

a > session
> > > variables. Page four is reached (a final review page) and then

the > > > information will be written to the SQL server.
> > >
> > > When I tried to enter some code in the HTML table by hand so I could get
> > it
> > > to show up in the right place. For example I use this code in the HTML
> > > table:
> > >
> > > <td><%=sessionv ar1%><%=session var2%></td>
> > >
> > > Compile and run, when I get to the 4th page it says that sessionvar1 has
> > not
> > > been declared. Can I use session variables this way to display the > > > information?
> > >
> > >
> >
> >
>
>



Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3923
by: Google Mike | last post by:
Tell me if this can be done, and if I have a misconception here. I am writing an app that will be served up in an app farm, and therefore I need to move the session information to the client, not using server-side session features. The way I have typically done this in the ASP world was with cookies. Another way to handle this is with a...
2
3328
by: Amit D.Shinde | last post by:
Hello Experts.. I need some help regarding cookies and session objects and also global.asa file I am creating one cookie when a user logs in on my website. The cookie stores the login name of the user. I want that cookie should get deleted when user closes the browser without signing out. I think it is done in global.asa file . But i...
1
2012
by: Scott Wickham | last post by:
I'm having a problem saving session information on one form and retrieving it on a subsequent form...for only one out of a number of users. Actually, I'm not absolutely certain it's a session problem but I'm hoping the experts can help me figure that out. Our application uses a session variable to "pass" info from one form to the next. It...
4
1212
by: David | last post by:
Hi. I developed an ASP.NET application that users just started testing and found a huge problem with. In one part of the application I am creating an instance of the class and save information that users provided there. If users want to they can view their previously saved entries. At that time I display the information to them. Another...
6
1574
by: -D- | last post by:
I'm trying to accomplish the following. I'm trying to get the values for the table rows that are dynamically created to persist through a redirect. Referring URL: http://www.dwayneepps.com/abr_site/fundingrequest.asp If you click on the "New Transaction" button it will generate a new row for the user to input information. I call a...
7
1647
by: Mike | last post by:
Hi, I am developing an application with framesets (header, left navigation, and content). Each frameset loads an ".aspx" page, and in one of these pages, I store some information in the Session object, as follows: .... Session = false; ....
8
1974
by: Steve Atkins | last post by:
I have an application where each user session opens and maintains a long-lived connection to the postgresql backend database. I need to keep a small amount of information (things like a unique session identifier, the application - as opposed to database - username and so on) that is local to each database session. It needs to be visible...
2
1626
by: asadikhan | last post by:
Hi, I have a table in my database called users which contains user information like their login id, password, first name, last name, phone, etc. Once I retreive this information, I'd like to hold it in memory. One obvious way of doing this is session variables. However, I am thinking whether usign a Dataset would be more suitable in this...
3
2031
by: RSH | last post by:
Hi, I have a situation where I have created an object that contains fields,properties and functions. After creating the object I attempted to assign it to a session variable so i could retrieve the information it contained on another page. This was significant because I am initially loading the data from the database, then storing relevent...
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7916
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8117
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6275
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.