I have not done something like this but I am assuming that you cannot use
the inline code to do what you are expecting as I think the inline will get
executed and sent to the stream before your processing as appears to happen.
Then your control evaluates and renders its content. I would expect that you
might want to have a custom tag that can contain the information you would
like to write or add it as an attribute to the Container tag.
Also, do you need the runat=server for the sub-tag SH:Container?
Fred
[quoted text, click to view] "Samuel Hon" <noreply@samuelhon.co.uk> wrote in message
news:c8672b7d.0405040505.64891aa3@posting.google.com...
> OK, I'm experiencing something strange now. The aspx rendering is
> working in reverse order
>
> In my aspx page, i'm using:
>
> <SH:Template runat="server">
> <SH:Container id="SH2" runat="server">
> <B>Render something here.</B>
> <% Response.Write("Something going on here.") %>
> </SH:Container>
> </SH:Template>
>
> In my control, I'm using:
>
> Namespace SH
> Public Class Template
> Inherits Control
>
> Protected Overrides Sub Render(Writer As HtmlTextWriter)
> Writer.WriteLine ("...")
> Writer.WriteLine(ReplaceText(Controls(1),strText))
> Writer.WriteLine ("...")
> End Sub
>
> Public Function ReplaceText(objControl As Control, _
> strText As String) As String
>
> Dim objStringWriter As New System.IO.StringWriter()
> Dim objHTMLWriter As New HtmlTextWriter(objStringWriter)
>
> objControl.RenderControl(objHTMLWriter)
>
> Dim str As String = objStringWriter.ToString()
> Return str.ToString()
> End Function
>
> End Class
> End Namespace
>
> What I'm finding is that my HTML page is coming up as
>
> Something going on here. Render something here.
>
> instead of
>
> Render something here. Something going on here.
>
> Any ideas? Cheers