<div runat="server"> tags not working

  • Thread starter Thread starter Tim Mulholland
  • Start date Start date
T

Tim Mulholland

I have one page where i have some <div> tags set to be runat="server" (and
i've given them an id) and i can access them from the code-behind file just
fine.
I have another page where i've done essentially the same thing (even copying
the code from the other file) and i cannot access them from the code-behind
file.

Any clues what would cause this?

Just a tad frustrating because i can't move forward on this page without
accessing those...

Thanks in advance,

Tim
 
Nice catch. No, i didn't have them declared in the code-behind.
Of course, i didn't declare them myself in the code-behind on the page that
worked. VS.NET must have done it on the first one and not on the second one
for some reason.
Interesting.
Thanks!

Tim
 
Did you check the contents of the windows designer
generated code from the source code-behind file? It may be
hiding a reference to the object, such as..

Protected WithEvents myControl as
system.web.webcontrols.label

You always need a reference in the code-behind to access
the web form controls.

Might help!
 
Yeah, i found that i was missing the reference in the code-behind. I hadn't
added it in myself in the first page, so i dind't remember that it had to be
there in the non-working page.
Thanks (and nice name...)

Tim
 
Back
Top