Re: Can a control produce html?

From: Adam Smith (none)
Date: 07/30/04

  • Next message: Steven Cheng[MSFT]: "Re: Naming container"
    Date: Fri, 30 Jul 2004 09:17:00 +0100
    
    

    Hi John,

    thanks for replying...

    Heres what I'm trying to acheive.
    This is for an e-mail marketing newsletter. The user enters the product
    ID's in the textboxes at the top of the page (along with layout and some
    other details). These are sent to multiple instances of the user control
    which displays the product in question. This is all graphically displayed
    in a Panel, so the user can see what the e-mail newsletter will look like.
    This all works fine.

    The Panel's html is grabbed via a htmltextwriter and deposited in the
    textarea, this is so any manual modifications can be made and later saved to
    a database for sending at a later date.

    This works partially, the user controls HTML is not being grabbed. I
    presume this is due to the calling of them happening after I grab the panels
    html.

    So where in the page life cycle do I need to grab the panels html in order
    to include the html of the user controls?

    Thanks in anticipation,

    --
    Adam Smith
    "John Saunders" <johnwsaundersiii@notcoldmail.com> wrote in message
    news:utDfObBdEHA.1604@TK2MSFTNGP11.phx.gbl...
    > "Adam Smith" <none> wrote in message
    > news:OKKV9t9cEHA.2908@TK2MSFTNGP10.phx.gbl...
    > > Forgive me, I was rather tired when I wrote that.
    > >
    > > The reason I couldn't see it in the source was because smartnav was on
    and
    > I
    > > hadn't realised.
    > >
    > > Ok that aside, I'm still after the html of a portion of the page.
    > >
    > > so here goes:
    > >
    > > <page start>
    > >
    > > Textboxes
    > > <div>
    > >  _______
    > > |___x___|
    > > |___x___|
    > > |___x___|
    > > |___x___|    <--- this is a table, the 'X' represents some user controls
    > > </div>
    > > A textarea
    > >
    > > <end of page>
    > >
    > > So, I enter some information in the textboxes.  This info is passed to
    the
    > > user controls, which then change accordingly.
    > > The textarea takes contains a copy of all the HTML in the div container.
    > >
    > > So this is presumably an event sequence problem.  How would I go about
    > > capturing the HTML generated by these controls?
    >
    > Let me make sure I've got this right. You want the output of the user
    > controls to be placed within the TextArea? Do you also want that output to
    > be sent to the user's browser, or do you only want it to appear inside of
    > the TextArea?
    >
    > You might have some luck by using a Panel control instead of a div. You
    > would then override the Render method of the page. In that method, you
    could
    > create an HtmlTextWriter which outputs to a string, then call
    > panel.RenderControl(stringHtmlWriter) to capture the HTML. You would then
    > have to find some way to get that string to render inside of your
    TextArea.
    > Also, if you want the page to render normally, you'd then have to call the
    > base class Render method.
    >
    > This is all quite unusual. Is this really what you want, or have I
    > misunderstood?
    > -- 
    > John Saunders
    > johnwsaundersiii at hotmail
    >
    >
    

  • Next message: Steven Cheng[MSFT]: "Re: Naming container"

    Relevant Pages