Asp.Net - Rendering HTML at RunTime

~J~

~J~

Soldato
Joined
20 Oct 2003
Posts
7,558
Location
London
Can someone give me some pointers on this please:

Got a DataList which I need to show different blocks of HTML based on various data.

I'm currently detecting the clauses on the ItemDataBound event, but can't seem to write HTML at a specified location.

For example:

Within the ItemDataBound event, I'm capturing a field and looking at it.
If the field is, say, "Over", then I want to find a control named "divBlock1" and render some HTML content in there.
If the field is, say, "Clockers", then I want to find a control named "divBlock2" and render some HTML content in there.

At present I have:

Dim builder As New System.IO.StringWriter()
Dim writer As New HtmlTextWriter(builder)
With writer
[.Stuff in here that I want to generate HTML wise.]
.Write("<B>Stuff in here</B>")
End With
writer.Flush()

But the only way to render that HTML is via a Response.Write, which of course plonks it at the top of the page and not where I want it.

Any thoughts?
 
Back
Top Bottom