how to get text from HttpWriter

T

tolisss

Hi

i m trying to make a custom ValidationSummary Control. So i override
the render method and i need to know the conents of the HttpWriter
parameter of that method so i can manipulate text

how could i make that?

thnks
 
C

cbDevelopment

If what you want to do is actually modify ASP.NET's generated control
html, you can do it like this:

Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
Dim sb As New System.Text.StringBuilder
dim html as string
Dim wr As New Web.UI.HtmlTextWriter(New IO.StringWriter(sb))
MyBase.Render(wr)
html=sb.tostring
' modify html here
writer.Write(html)
End Sub

This sub creates a stringbuilder, makes an HTMLTextWriter that writes to
the stringbuilder, then renders the base control into the stringbuilder.
Now we have the html text. Modify it as needed, then send it to the real
HTMLTextWriter.
 

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,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top