getElementByID on the server side

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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...
 
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.
 
Back
Top