473,414 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

<div runat="server"> tags not working

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
Nov 18 '05 #1
4 4244
so you have them declared in the codebehind?

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Tim Mulholland" <Ti***********@nospamaddress.com> wrote in message
news:eN**************@TK2MSFTNGP10.phx.gbl...
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

Nov 18 '05 #2
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

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
so you have them declared in the codebehind?

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Tim Mulholland" <Ti***********@nospamaddress.com> wrote in message
news:eN**************@TK2MSFTNGP10.phx.gbl...
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


Nov 18 '05 #3
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!

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

Any clues what would cause this?

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

Thanks in advance,

Tim
.

Nov 18 '05 #4
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

"Michael Mulholland" <an*******@discussions.microsoft.com> wrote in message
news:76****************************@phx.gbl...
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!

-----Original Message-----
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
.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael | last post by:
There seem to be two ways to include files on the server: 1. <!-- #include file="header.inc" --> 2. <script language="VBScript" runat="server" src="header.inc"></script> What are the differences...
1
by: Hai Nguyen | last post by:
Hi all I have a several User Controls which require this tag: "<form runat="server">. I tried to have all of these user user controls on the same web page. It kept giving me an error :""A page...
3
by: Jaime Stuardo | last post by:
Hi all... Both controls are server side. The former has more properties. Both may have associated events that are ran at server. Which one are recommended to use? is performance an issue? in...
3
by: Jim in Arizona | last post by:
Most of the asp.net learning I've done has been from books that were written during the 1.0 framework. I didn't have a copy of visual studio when I started reading them then I got a hold of VS 2005...
0
by: Tom | last post by:
I need to use DynamicHoverStyle. I read that in order to do so, I must add a <head runat="server" /> at the top of my UserCOntrol. When I do this though, my DynamicMenuItemStyle items get...
4
by: Kevin Blount | last post by:
bit long winded this one, so stick with me: I'm trying to create a form that can go to one of 3 places, depending on various elements. My form control looks like this: <form runat="server"...
1
by: mark4asp | last post by:
<form runat="server"automatically adds <divtag to code contained within. Is there a way to stop that? Mixing block-level elements with inline-level elements messes up the HTML becasuse that is...
19
by: Scott M. | last post by:
Why do we need runat="server" on our <headtags?
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.