Having a UserControl returned in a string from another UserControl to be rendered

Discussion in 'ASP .Net' started by SlimFlem, Dec 2, 2005.

  1. SlimFlem

    SlimFlem Guest

    I hope this makes sense.

    Here is what I am attempting. I have an inital generic aspx page that
    has one custom tag:

    <web:site id=webSite runat=server/>

    When this control evaluates, it will return a small amount of Html with
    another custom control tag inside this html. For example:

    <table>
    <tr>
    <td><web:page id=webPage runat=server/></td>
    </tr>
    </table>

    In turn, this web:page control will have multiple other custom tags
    called web:content. When asp.net renders this, only the initial custom
    control I have embedded in the generic aspx page actually renders. The
    web:site tag renders with the web:page custom control tag showing in
    the rendered page source as plain text, it was never rendered.

    What I need is a way to tell asp.net to render any custom control tags
    I spit out inside text/html strings and have this repeat down thru a
    series of controls.

    How do I tell asp.net to essentially "re-render" the page. Hopefully
    someone has done something similar and I am speaking clearly.

    Thanks.
     
    SlimFlem, Dec 2, 2005
    #1
    1. Advertising

  2. I do not think you can do that. Once the page has loaded, all the controls
    have been parsed and processed.

    Having said that, you can dynamically load controls using the LoadControl
    method and add it to the Controls collection, but once ASP.NET has finished
    parsing the document, it will not parse it anymore.

    Maybe your goal does not fit with a proper design. What specifically are
    you trying to do and maybe I can offer a better alternative?

    From your small information below, maybe a better solutions would be to
    constrain your top-level control even more by requiring that it return an
    actual WebControl (or something) that can then be added to the Controls
    collection at the proper place.

    I am always cautions to allow my code to return data that cannot be
    validated for correctness. For instance, by allowing any string to be
    returned, you have no idea what will be returned, while if you return a
    WebControl instance, then you know that it can be rendered.

    "SlimFlem" <> wrote in message
    news:...
    >I hope this makes sense.
    >
    > Here is what I am attempting. I have an inital generic aspx page that
    > has one custom tag:
    >
    > <web:site id=webSite runat=server/>
    >
    > When this control evaluates, it will return a small amount of Html with
    > another custom control tag inside this html. For example:
    >
    > <table>
    > <tr>
    > <td><web:page id=webPage runat=server/></td>
    > </tr>
    > </table>
    >
    > In turn, this web:page control will have multiple other custom tags
    > called web:content. When asp.net renders this, only the initial custom
    > control I have embedded in the generic aspx page actually renders. The
    > web:site tag renders with the web:page custom control tag showing in
    > the rendered page source as plain text, it was never rendered.
    >
    > What I need is a way to tell asp.net to render any custom control tags
    > I spit out inside text/html strings and have this repeat down thru a
    > series of controls.
    >
    > How do I tell asp.net to essentially "re-render" the page. Hopefully
    > someone has done something similar and I am speaking clearly.
    >
    > Thanks.
    >
     
    Peter Rilling, Dec 2, 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. e
    Replies:
    1
    Views:
    368
  2. nail
    Replies:
    0
    Views:
    1,546
  3. =?Utf-8?B?QW5vbg==?=

    Usercontrol not rendered in table

    =?Utf-8?B?QW5vbg==?=, Dec 9, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    361
    =?Utf-8?B?QW5vbg==?=
    Dec 9, 2004
  4. Leeor Chernov
    Replies:
    2
    Views:
    793
    Leeor Chernov
    Oct 16, 2005
  5. Matt Sokol
    Replies:
    2
    Views:
    388
    Theo Tillotson
    Aug 7, 2003
Loading...

Share This Page