I'm not quite sure what you're trying to do...
I'm guessing you want to create content to embed into the page, right? In that case you can't generate the HTML Markup for controls, because that markup is parsed at COMPILE time (ie. before any code in the page runs). So you can't add <ww:wwWebTextBox /> as text into the page and expect that to render because the parsing is already done when the page runs.
However, you *can* add new controls like a new TextBox or label or datagrid to an existing Page or Container and add it to the page:
loTextBox = CREATEOBJECT("wwWebTextBox") loTextBox.Id = "txtName" loTextBox.Value = "Dynamically added text" *** Add to Page - not super practical with visible controls *THIS.AddControl(loTextBox) *** Or Add to another Container Control like a placeholder panel THIS.panDynamicPanel.AddControl(loTextBox)
Generally if you inject visible controls you'll want to add them to some other container control that effectively makes up the area where you need to embed the dynamic controls. Otherwise you don't have any control where the controls go as they are always added to the bottom of the ChildControls collection.
Another alternative for dynamically generated content is to just generate plain HTML and embed it into a wwWebLiteral control. The literal control renders any text as is and so content comes out as is. You can even use some of the HtmlHelpers (in wwHtmlHelpers.prg) to facilitate that process to handle things like Auto-Postbacks and model assignment.
But all that said - for meta Web pages that dynamically create content based on data structures from the database, Web Control Pages are not the best choice since they expect a rigid structure of a page to begin with. It's possible to do, but makes sense only if you build the entire page dynamically. If you want an idea of what that looks like, look at the source for a generated page - basically your code can use this same logic to dynamically create a page layout at runtime (or inject into a base page as long as you have a container that you can AddControl() to.
+++ Rick ---
from Maui, Hawaii