Noob question about returning HTML

T

ToChina

Hi, I have a simple web page which has a file upload section, where the user
can select a file, hit the upload button, and then view details about the
file, which appear underneath the upload section.

The information about the file will be returned as XHTML, therefore I want a
control on the web form which is just a container for HTML so that in my
code behind file I can do something like:

// if file has successfully uploaded

htmlContainer.Text = "<table><tr><td>Whatever details</td></tr></table>";

I can't seem to find an appropriate control. What am I missing? apart from
a brain.

I could use the Response class, but I don't want to lose the file upload
section at the top of the form.
 
J

John Timney \(ASP.NET MVP\)

The correct way would be to look at using a placeholder control and put
other controls in it - like table controls or labels.
--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
T

ToChina

John Timney (ASP.NET MVP) said:
The correct way would be to look at using a placeholder control and put
other controls in it - like table controls or labels.
--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

I've found a method that works - I don't know if there's anything wrong with
it, but basically I've added the following to the web form:

<div id="container" runat="server"></div>

and then in the code behind I have this:

protected System.Web.UI.HtmlControls.HtmlContainerControl container;

container.InnerHtml = "<table>...</table>";

now the HTML gets rendered right on the page.
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top