Re: Dynamic User Controls
From: Martin Dechev (detcheff__at_hotmail.com)
Date: 09/22/04
- Next message: Kevin Spencer: "Re: Very frustrating caching issue..."
- Previous message: Kevin Spencer: "Re: Opening / Closing SQL Server connections"
- In reply to: anthonyroche: "Dynamic User Controls"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 22 Sep 2004 15:38:59 +0200
Hi,
You will have to parse the "html" (which happens to be a little bit more
than html) and add the controls by yourself. Let's suppose you have a method
that renders the "html" in question with the following signature:
public void Render(string content, HtmlTextWriter writer){}
You will have to parse the string in content. So, when you find pure html
(for direct output) do:
writer.Write(pureHtml);
When you find some control (i.e. WUCNews) you will have to first instantiate
it from the corresponding class:
WUCNews news1 = new WUCNews();
Then probably set some properties (you might need to parse some attributes):
news1.Page = Page;
news1.EnableViewState = false;
// etc...
And in the end render it:
news1.RenderControl(writer);
Hope this helps
Martin
"anthonyroche" <anthonyroche@ewiz.com.au> wrote in message
news:3847fcd6.0409211950.2e209073@posting.google.com...
> I have a web app (ASP.Net) using Templates with predominatly the body
> content stored in the db and displayed to screen using a PageID
> querystring. What I want to know is, if a content manager adds the
> tags
> <wuc:news id="News" runat="server"></wuc:news> into the body section
> via a CMS together with other page data (HTML content), how can I
> detect this tag (user control) and actually load it in the place
> he/she wants.
> Example HTML content loaded from db
>
> <table><tr><td>some text here</td></tr>
> <tr><td> more text maybe with images</td></tr>
> <!-- NOW I WANT THE NEWS USER CONTROL -->
> <tr><td><wuc:news id="News" runat="server"></wuc:news></td></tr>
> </table>
>
> I use a placeholder on the template page to pick up the string(above)
> that is stored in the DB which works fine. When I view source I can
> see the <wuc.. tag but ofcourse the news control is not rendered or
> loaded.
>
> Any ideas?
- Next message: Kevin Spencer: "Re: Very frustrating caching issue..."
- Previous message: Kevin Spencer: "Re: Opening / Closing SQL Server connections"
- In reply to: anthonyroche: "Dynamic User Controls"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|