Last post Dec 09, 2014 06:50 PM by flytrap50
Dec 04, 2014 06:20 PM|flytrap50|LINK
I have a user control that I made that works great by itself. If I add two of the same user controls to a page, things go south. It is like the two user controls get merged and only the second one gets the changes.
The user control has a table on it. The table has a header, that I store in a variable, I then add items to the header based on what the user wants. The problem is, I add both user controls, and when I add items to the header, it adds them to the second
user control only. Even though I am specifying the correct control.
I have been stuck on this for a week and can't find a solution. Any ideas? Is there some way to isolate the user control so it doesn't bleed over?
Dec 05, 2014 04:55 AM|AidyF|LINK
Don't use static variables, static variables are the same for everyone using the site, they are global. Not only is your data being shared between controls, but if you look at your site from a different browser or machine you'll find they are getting shared
between all users too. If you are using static variables to fix a particular problem then you need a different solution to that problem.
Dec 09, 2014 06:50 PM|flytrap50|LINK
I changed to using a session variable for the main collection, that contains all my control data. I am guessing that resolves any problem with multiple users, but it still gets confused with two controls on the same page.
So problem partially resolved.