Setting Session variable to List SelectedIndex 
Author Message
 Setting Session variable to List SelectedIndex

I'm trying to set a session variable equal to the SelectedIndex property of
a list at the time of form posting.  I can't seem to find a way to do this.
What I have is:

<%
Session("theIndex") = document.Form1.theList.SelectedIndex
%>

I get an error from the document object.  Is there a way to do this?

TIA,
Andy



Sat, 08 Feb 2003 03:00:00 GMT  
 Setting Session variable to List SelectedIndex
You need to pass

document.Form1.theList.SelectedIndex

as the value of a hidden form field and then retrieve it on the server side via

Request.Form("hiddenfieldname").

That means you'll need an onsubmit handler on the client side to plug the value into the hidden
field.

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> I'm trying to set a session variable equal to the SelectedIndex property of
> a list at the time of form posting.  I can't seem to find a way to do this.
> What I have is:

> <%
> Session("theIndex") = document.Form1.theList.SelectedIndex
> %>

> I get an error from the document object.  Is there a way to do this?

> TIA,
> Andy



Sat, 08 Feb 2003 03:00:00 GMT  
 Setting Session variable to List SelectedIndex

Worked great!  Thanks!


Quote:
> You need to pass

> document.Form1.theList.SelectedIndex

> as the value of a hidden form field and then retrieve it on the server
side via

> Request.Form("hiddenfieldname").

> That means you'll need an onsubmit handler on the client side to plug the

value into the hidden
Quote:
> field.

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --



Quote:
> > I'm trying to set a session variable equal to the SelectedIndex property
of
> > a list at the time of form posting.  I can't seem to find a way to do
this.
> > What I have is:

> > <%
> > Session("theIndex") = document.Form1.theList.SelectedIndex
> > %>

> > I get an error from the document object.  Is there a way to do this?

> > TIA,
> > Andy



Sat, 08 Feb 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. dotnet Session variable set too late - Error Page Description related

2. browser window size, set to a session variable?

3. Setting ASP Session variable

4. Setting a session variable from a href

5. Getting/Setting Session Variables from JavaScript

6. Can an onClick set a session variable?

7. setting session variables with dynamic identifiers?

8. Request for Help: setting session variables using javascript.

9. browser window size, set to a session variable?

10. Setting ADO Recordsets as session variables

11. Session variables re-set strangely

12. setting a session variable dynamically

 

 
Powered by phpBB® Forum Software