Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I’m working on a web project in which I stored profiles of many institute. When I select institute from the list, the profile of the institute is displayed. Institute profile contains different pages. I am using session to store the institute’s ID on which the profile is displayed. Contents of each page of specific institute’s profile are displayed on the basis of Session[“instID”].

Problem is that when I open the different institute profile in different tabs of the same browser Session value change.

Suppose I opened three institute profiles named A, B and C. I’m using the session[“InstID”] to display its profile. Now when I access other pages of institute A I can’t because Session contains the ID of Institute C. Instead of displaying the contents of institute A it shows me the contents of Institute’s C. How Should I manage Session in this scenario?
Posted
Updated 18-Oct-14 20:20pm
v2

1 solution

You don't use the session to store the data. I personally only use the session to store certain things that are global to the website, and can only be 1 value.

So either the session value exist, or there is no session to store the value.

According to your description, the session value contains the correct value.

You vague description suggest that its one page using tabs, so the page doesn't change.

Since you didn't give any details on how you built the form, I will just use the concept.

So you make 3 containers that are div elements or panels, each container has a unique id, the value your storing in the session; and when you change institutes you just switch panels to the one you want to display.

TAB1 TAB2 TAB3
<div>
<div>Institute 1<div>
<div>Institute 2<div>
<div>Institute 3<div>
</div>
</div></div></div></div></div></div>


So if your using asp.net object, it's panels or the HTMLGenericControl because you can manipulate the innerHTML.
Dim panel1 as htmlgenericcontrol = new htmlgenericcontrol("div")
panel1.id = value
panel1.innerHTML = "<span>description</span>"
panel1.visible = false
controls.add(panel1)

Dim panel2 as htmlgenericcontrol = new htmlgenericcontrol("div")
panel2.visible = false
panel2.innerHTML = "<span>description</span>"
controls.add(panel2)

<asp:panel id="panel1" runat="server" visible="true" xmlns:asp="#unknown"> </asp:panel>
<asp:panel id="panel2" runat="server" visible="false" xmlns:asp="#unknown"> </asp:panel>

Private Protected Sub tab_1_Click 
panel1.visible = true
panel2.visible = false
end sub

Private Protected Sub tab_2_Click 
panel1.visible = false
panel2.visible = true
end sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900