I want to have re-usable page elements on my site. These elements will be laid out in
HTML, and will use server controls and custom controls.
A simple example for a page element would be something like this:
<b>foo!bar! <jl:MyCustomControl id=\"myCustom\" runat=\"server\"></jl:MyCustomControl> baz!quux!</b>
(where jl is the tag prefix for the namespace that contains my custom controls)
It would seem that .ASCX user controls would be perfect for something like this. However, user controls cannot be used across applications. .NET 2.0 gives us the ability to precompile user controls, which are then usable across applications. However, I need a non-programmer to be able to make changes to these user controls. Hence, precompiling seems to be out of the question.
I feel like I can accomplish what I need by saving a given page element to a string in the database. We'll call this string the "input string". I can then render the input string through a user control of some sort. However, there's a snag - how do I render the input string in such a way that the control tags are properly rendered as controls?
I've tried to do simple things like this :
this.Response.Write(strInputString);
However, in place of my custom control, it outputs nothing at all.
What are some good strategies for solving this problem? Is it necessary to have something that parses the input string, builds a controls hierarchy, and then adds that hierarchy to the webform? If so, is there anything built into .NET that can help me?