<div runat="server"> tags not working

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
 
T

Tim Mulholland

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
 
M

Michael Mulholland

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!
 
T

Tim Mulholland

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
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top