how to get text from HttpWriter

Discussion in 'ASP .Net' started by tolisss, Nov 16, 2005.

  1. tolisss

    tolisss Guest

    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
    tolisss, Nov 16, 2005
    #1
    1. Advertising

  2. 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.

    "tolisss" <> wrote in
    news::

    > 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
    >
    >
    cbDevelopment, Nov 18, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Tmlja3k=?=
    Replies:
    2
    Views:
    695
    Matt Berther
    Feb 20, 2005
  2. Alex9968
    Replies:
    0
    Views:
    566
    Alex9968
    Mar 19, 2008
  3. Alex9968
    Replies:
    0
    Views:
    1,500
    Alex9968
    Mar 19, 2008
  4. neilr
    Replies:
    1
    Views:
    407
    neilr
    Sep 1, 2008
  5. leo
    Replies:
    1
    Views:
    268
    Bob Lehmann
    Dec 5, 2005
Loading...

Share This Page