Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Pass session variable?

Author  Topic 

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-03-11 : 12:02:41
I need help passing a session variable from my main page to a popup window. How would I go about doing this?

Here's how my popup window is like:

Onclick="windowOpen('http://intranet/Quotes/CreateNew.aspx', 'CreateNew');"

Here's the variable that I want to pass:

Session("AuthUser") = strUser

My idea is that when the user click on the create new quote button, it will carry the user's username (from login page) to the popup window so that we can have a record of who created the quote.

I was able to get it to work if it's within the same IE window, but when use with the pop, seems like it's a new session so it doesn't get carry on. I need a way to pass it so that it will carry to the new window. I'm thinking somewhere with my URL but I'm not quite sure.

Please advise.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-11 : 12:12:54
you can pass it through the querystring.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-03-11 : 13:37:17
quote:
Originally posted by spirit1

you can pass it through the querystring.

Go with the flow & have fun! Else fight the flow



"windowopen('http....' & Session(myVar) & "'", 'CreateNew');"



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-03-11 : 15:12:18
Thanks both for responding , but I can't seem to pass it to the pop up window. Here's what I did with each suggestions.

Spirit1:

Onclick="windowOpen('http://intranet/Quotes/CreateNew.aspx?user='<%#strUsers%>', 'CreateNew');

For behind code I have it as for page that is grabbing the variable.

strUsers = Request.QueryString("user")

I'm getting blanks. It seems like it's not seeing the variable or something is missing in my code.

Jon:

Onclick="windowOpen('http://intranet/Quotes/CreateNew.aspx' & Session("AuthUser") & "'", 'CreateNew');"

This does not work either. It gives me an error at startup.

Please advise.
Go to Top of Page

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-03-11 : 15:57:16
Just a little correction with one of the example I provided.

Onclick="windowOpen('http://intranet/Quotes/CreateNew.aspx?user='<%#strUsers%>', 'CreateNew');

On same page I put this:

strUsers = Session("AuthUsers")

For behind code I have it as for page that is grabbing the variable.

txbQuoteID.Text = Request.QueryString("user")
Go to Top of Page
   

- Advertisement -