Question on building Web Custom Controls

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • The Alchemist

    Question on building Web Custom Controls

    The 'Render' method of a Web Custom Control takes an argument 'output'
    of type System.Web.UI.H tmlTextWriter. This HtmlTextWriter renders any
    content in the 'Render' method.

    I am trying to render the content of my control in ANOTHER method.
    When I try to create a new HtmlTextWriter in that method with the
    code:

    Dim writer As New StringWriter
    Dim output2 As New HtmlTextWriter( writer)
    output2.Write(" TEST")

    ....it does nothing. This method is being called by another control to
    in order to render some content. Can someone please advise how I can
    render content from a custom method in a Web Custom Control.

    Thanks in advance for any help.
  • John Saunders

    #2
    Re: Question on building Web Custom Controls

    "The Alchemist" <alkamista@lyco s.com> wrote in message
    news:ee4cf350.0 406011552.4cef9 4c@posting.goog le.com...[color=blue]
    > The 'Render' method of a Web Custom Control takes an argument 'output'
    > of type System.Web.UI.H tmlTextWriter. This HtmlTextWriter renders any
    > content in the 'Render' method.
    >
    > I am trying to render the content of my control in ANOTHER method.
    > When I try to create a new HtmlTextWriter in that method with the
    > code:
    >
    > Dim writer As New StringWriter
    > Dim output2 As New HtmlTextWriter( writer)
    > output2.Write(" TEST")
    >
    > ...it does nothing. This method is being called by another control to
    > in order to render some content. Can someone please advise how I can
    > render content from a custom method in a Web Custom Control.[/color]

    What is the value of writer.ToString () after the Write? You may also need to
    use output2.Flush() before you see the result.
    --
    John Saunders
    johnwsaundersii i at hotmail


    Comment

    Working...