getElementByID on the server side

G

Guest

hey all,
is there a way to say getElementById on the server side or is setting the
html control as runat="server" the way to go?

i'm just trying to get to a div and add controls to it.

thanks,
rodchar
 
M

Mark Rae [MVP]

is there a way to say getElementById on the server side or is setting the
html control as runat="server" the way to go?

The only way a control can be handled server-side is if it actually runs
server-side - as you say, runat="server" is the way to go...
i'm just trying to get to a div and add controls to it.

If you use an <asp:panel>, that will render as a <div> anyway...
 
G

Guest

rodchar said:
hey all,
is there a way to say getElementById on the server side or is setting the
html control as runat="server" the way to go?

i'm just trying to get to a div and add controls to it.

thanks,
rodchar

Everything in the markup code is handled as server controls. The html
code that doesn't have runat="server" is handled as text in
LiteralControl controls.

You could theoritically look for the element in the literal controls of
the page, but that's not practical. Put runat="server" in the div so
that it becomes a server control in itself, or put a PlaceHolder inside
the div to add the controls in.
 

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,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top