Odd web control problem. Two instances of control A on different pages display each other's data!

N

~~~ .NET Ed ~~~

I am currently using the ScottWatter (or ScottWater) Amazon Book Control in
a website I am developing. Basically this is the outline:

- It is a custom web control with designer support
- Does not depend on any other library with the exception of a few Framework
(System.Data,.XML,.Designer) libraries.
- You control it by telling it (via a property) the path to the XML
configuration file.
- The control registers its XML configuration file as a response file
dependency
- The control has ViewState disabled because it does not need to remember
any information during PostBacks

It uses the configuration file to select a random book from the list and
display it. Pretty simple really. So what is the problem?

An odd one but I may be missing something. This BookControl is used in two
different pages of the website. Each
instance is on a *different* page, Each instance was assigned the
"BookControl1" ID by vs.net. Each control is given a *different*
configuration file, i.e BookControl1 on page A is about Technical books, and
BookControl1 on page B is about Fiction.

The problem here is that even though the controls are on *different* pages,
some times the control on Page B starts selecting books from the control on
Page A and viceversa!!!! this is very strange because they are on different
pages (have I stressed that enough?) and have no idea about the other
control's configuration file.

Is it possible that the web control IDs (BookControl1 in this case) need to
be UNIQUE across a site and not just a page?, meaning I cannot have two
controls named BookControl1 in the same ASP.NET application as a whole?.
This means that if you have it 20 times on 20 different pages you have to
keep track of that yourself because Visual Studio will always assign it a
name BookControl1 every time it is the "first" control of that kind on a
page.

Any feedback on this is welcome, I find it odd but I could be missing some
ASP.NET small letters some place ;)

Thanks in advance
Em.
 
N

~~~ .NET Ed ~~~

Even more odd (?), I gave them different names:
Page A: BookControl1 book selector file: X.xml
Page B: BookControl2 book selector file: Y.xml

And now, not only does the problem still persists, now every now and then
the control disappears completely from the rendered page... That never
happened b4, and the DLL containing the control (or the code of the control)
have not even changed.

I am really puzzled by this behaviour.
 
N

~~~ .NET Ed ~~~

Got hold on the source again. The author was using Context.Cache with the ID
and that was causing the controls to jump on each other's toes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top