Response.write in UserCOntrol

P

Peter Aitken

In my usercontrol I want to use response.write in code behind to write HTML
to the page. However it outputs at the top of the page and I want the output
at the bottom, beneath the controls. How can I do this? Or is there a better
way than response.write to do what I want?
 
P

Peter Aitken

Curt_C said:
use an asp:Label control, then populate it, that's what it's for.

I don't think so - I need to write HTML with headings, tables, etc.
 
K

Kevin Spencer

All HTML in an ASP.Net page is objects on the server at runtime (yes, even
"static" HTML). ASP.Net is object-oriented. Response.Write is procedural.
For this reason, a Page is populated by creating objects and placing them in
its Controls Collection. The properties of the objects create the HTML in
the page.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
P

Peter Aitken

Kevin Spencer said:
All HTML in an ASP.Net page is objects on the server at runtime (yes, even
"static" HTML). ASP.Net is object-oriented. Response.Write is procedural.
For this reason, a Page is populated by creating objects and placing them in
its Controls Collection. The properties of the objects create the HTML in
the page.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP

Thanks. I discovered that I can do what I want by including the following
tag on the page:

<span id="report" runat="server"></span>

Then including this code in the code behind:

report.innerHTML="whatever"
 

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

Top