Re: session variable issue?

From: William F. Robertson, Jr. (wfrobertson_at_kpmg_dot_com)
Date: 10/11/04


Date: Mon, 11 Oct 2004 09:27:48 -0500

You are never assigning Session("Selection") to anything.

You are setting the string "cars" to 'Y', but since never assign the Session
it will not work the way you want. I can give a more detailed explaination
if you need one, but for now reverse your code like so:

'do not call .ToString() on this, just use the bool value checkd
if checkbox.checked = true then
    dim cars as string
    cars = "Y"
    Session("selection") = cars
end if

Then you code on the next page will work as you are hoping for it to work.

bill

"Mike" <Mike@discussions.microsoft.com> wrote in message
news:3C57CB24-247E-433D-8971-D2E4E7CE3859@microsoft.com...
> I have a function that is called when the user clicks the submit button,
> during this function i also set a varaible to "Y" due to that this
function
> does a post back to the page then redirects. When I look for the session
> variable in the page.isPostBack section it equals nothing, it appears
that
> the variable is not being passed to the post back section correctly. I
have
> this due to I only want this function to run if the user has something
> selected in the grid.
>
> code:
> if checkbox.checked.tostring() = true then
> dim cars as string = session("selection")
> cars = "Y"
> end if
>
> in the post back
> if page.isPostback
> if session("selection") = "Y" then 'this equals nothing I debugged it
and
> its getting set in the function but being passed as NOTHING
> run Function
> end if
> end if
>
>
>


Loading