|
 |
asp_web_howto thread: Re: Cache data in session variable for drop-down
population
Message #1 by Paul R Stearns <pauls@c...> on Mon, 17 Jun 2002 15:54:55 -0400
|
|
Grant:
Pardon the error on the move next line it should be
rs.MoveNext()
If it isn't obvious you would use the following wherever you currently have the drop
down list;
<% =session("droplist") %>
The example provided displays 3 items high & allows multiple selections.
Paul
Paul R Stearns wrote:
> Grant:
>
> Depending on whether this data changes, you may wish to store it in an application
> variable.
>
> To do what you want to do, take the code which currently writes the select box,
> and remove the response.writes, and concatenate the whole mess together. here is
> an example;
>
> rs.open
> nl = chr(13)
> session("droplist") = "<select name='droplist' size='3' multiple>" & nl
> session("droplist") = session("droplist") & " <option value='All' selected>" &_
> "<b><font face='Arial, Helvetica, sans-serif' size="2"
> color='#FFFFFF'>All</font></b></option>" & nl
> while not rs.eof
> session("droplist") = session("droplist") & " <option value=' & rs("value_field")
> & "'><b>" & _
> "<font face="Arial, Helvetica, sans-serif" size='2' color='#FFFFFF'>" &
> Rs("Display_field") &_
> "</font></b></option>" & nl
> RsCoverages.MoveNext()
> wend
>
> Paul
>
> Grant Whitfield wrote:
>
> > Hello all,
> >
> > i have a site that has a drop-down list on every page, the contents of
> > which is gathered from the access database - Name and ID.
> >
> > However, i would like to optimize the pages by storing the (drop-down)
> > data in a session variable so the database does not have hit every time
> > the pages load. I understand this would be done in the Global.asa file
> > but can someone help me as to what exactly i have to do...
> >
> > please be gentle, i'm only learning!
> >
> > thanks
> >
> > Grant
> >
> > ---
> >
> > Improve your web design skills with these new books from Glasshaus.
> >
> > Usable Web Menus
> > http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> > r-20
> > Constructing Accessible Web Sites
> > http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> > r-20
> > Practical JavaScript for the Usable Web
> > http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> > r-20
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
Message #2 by Paul R Stearns <pauls@c...> on Mon, 17 Jun 2002 15:24:05 -0400
|
|
Grant:
Depending on whether this data changes, you may wish to store it in an application
variable.
To do what you want to do, take the code which currently writes the select box,
and remove the response.writes, and concatenate the whole mess together. here is
an example;
rs.open
nl = chr(13)
session("droplist") = "<select name='droplist' size='3' multiple>" & nl
session("droplist") = session("droplist") & " <option value='All' selected>" &_
"<b><font face='Arial, Helvetica, sans-serif' size="2"
color='#FFFFFF'>All</font></b></option>" & nl
while not rs.eof
session("droplist") = session("droplist") & " <option value=' & rs("value_field")
& "'><b>" & _
"<font face="Arial, Helvetica, sans-serif" size='2' color='#FFFFFF'>" &
Rs("Display_field") &_
"</font></b></option>" & nl
RsCoverages.MoveNext()
wend
Paul
Grant Whitfield wrote:
> Hello all,
>
> i have a site that has a drop-down list on every page, the contents of
> which is gathered from the access database - Name and ID.
>
> However, i would like to optimize the pages by storing the (drop-down)
> data in a session variable so the database does not have hit every time
> the pages load. I understand this would be done in the Global.asa file
> but can someone help me as to what exactly i have to do...
>
> please be gentle, i'm only learning!
>
> thanks
>
> Grant
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
Message #3 by "Paulo Fernandes" <paulofernandes@c...> on Mon, 17 Jun 2002 17:08:34 +0100
|
|
When you submit the form, you can create a session variable on the
destination page, with <% session("variable_page1")
request.form("drop-down_1")%> and so on...
PauloF
-----Original Message-----
From: Grant Whitfield [mailto:grant.whitfield@s...]
Sent: segunda-feira, 17 de Junho de 2002 16:50
To: ASP Web HowTo
Subject: [asp_web_howto] Cache data in session variable for drop-down
population
Hello all,
i have a site that has a drop-down list on every page, the contents of
which is gathered from the access database - Name and ID.
However, i would like to optimize the pages by storing the (drop-down)
data in a session variable so the database does not have hit every time
the pages load. I understand this would be done in the Global.asa file
but can someone help me as to what exactly i have to do...
please be gentle, i'm only learning!
thanks
Grant
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
Message #4 by "Grant Whitfield" <grant.whitfield@s...> on Mon, 17 Jun 2002 16:49:40
|
|
Hello all,
i have a site that has a drop-down list on every page, the contents of
which is gathered from the access database - Name and ID.
However, i would like to optimize the pages by storing the (drop-down)
data in a session variable so the database does not have hit every time
the pages load. I understand this would be done in the Global.asa file
but can someone help me as to what exactly i have to do...
please be gentle, i'm only learning!
thanks
Grant
|
|
 |