Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Caching / April 2004

Tip: Looking for answers? Try searching our database.

Caching Problem - Cache being overridden

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Darren Newton - 02 Apr 2004 16:01 GMT
Hi

I am having a problem with caching :

I have a page that has several drop down lists on it. The data for these lists are stored in a SQL server database. At the moment, when the page loads, I loop through the DB table adding the items to a System.Web.Ui.WebControls.ListItem array. This array is then added to each list box

What I was hoping to do was store the System.Web.UI.WebControls.ListItem array in Cache. Initially the items get added to the Cache OK and the listbox gets populated as it should. However, after an item from a dropdown list has been selected and the changes posted back to the server a problem occurs

Next time I load the page, the Cache has been updated so that the item I selected has its selected property set to true

I do not understand how this can happen as I do not modify the Cache after it has first been created. The only thing I can think is that a reference is being stored in Cache not the actual value

Any ideas?
Alvin Bruney [MVP] - 04 Apr 2004 01:29 GMT
Couple things

Are you checking Page.Ispostback method in your page load?
How are you adding the items to the listboxes since they are added by
references.

Signature

Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok

> Hi,
>
> I am having a problem with caching :-
>
> I have a page that has several drop down lists on it. The data for these lists are stored in a SQL server database. At the moment, when the page
loads, I loop through the DB table adding the items to a
System.Web.Ui.WebControls.ListItem array. This array is then added to each
list box.

> What I was hoping to do was store the System.Web.UI.WebControls.ListItem array in Cache. Initially the items get added to the Cache OK and the
listbox gets populated as it should. However, after an item from a dropdown
list has been selected and the changes posted back to the server a problem
occurs.

> Next time I load the page, the Cache has been updated so that the item I selected has its selected property set to true.
>
> I do not understand how this can happen as I do not modify the Cache after it has first been created. The only thing I can think is that a reference is
being stored in Cache not the actual value.

> Any ideas?
Darren Newton - 05 Apr 2004 14:41 GMT
Hi

1) Yes I am checking IsPostBack. However the drop down lists I am adding are in a placeholder as they are dynamically generated

2) I am adding items using the listbox.Items.AddRange method.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.