Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Framework or Classic

$
0
0
Re: Framework or Classic
Web Connection 5.0
Re: Framework or Classic
10/16/2012
03:30:04 PM
3ME0X84JT Show this entire thread in new window
Gratar Image based on email address
From:
Rick Strahl
To:
Attachments:
None
Hi Mark,

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 ---


Hi All

I am currently bringing my old classic app up to date and i am starting to confuse myself.


I am trying to build flexibilty into the form content.

I have built a base page with Headers & footers using ASCX

Added a little fixed HTML.

What I am trying to do is only show data that the user is authorised to edit.

I have added a chunk of code in the on load to generate the additional elements how do I get them to render? I am just getting the text but no input boxes which makes sense as the fields haven't been processed by the handler.

Copy of HTML from View Source

table class="" > <tr> <td class="recordheaderlight">Dict(f) : Docket:</td> <td><ww:wwWebTextBox runat="server" id="txtDocket" ControlSource="oudocket.odata.Docket" /></td> </tr> <tr> <td class="recordheaderlight">Dict(f) : Descrip:</td> <td><ww:wwWebTextBox runat="server" id="txtDescrip" ControlSource="oudocket.odata.Descrip" /></td> </tr> <tr> <td class="recordheaderlight">Dict(f) : Ordqty:</td> <td><ww:wwWebTextBox runat="server" id="txtOrdqty" CssClass="number" ControlSource="oudocket.odata.Ordqty" style="text-align: right" /></td> </tr> </table></center>
<

I think my best approach is probably to process in the classic way generating the HTML on the fly using the new helpers and return that back to browser rather than trying to make the framework do this.

Framework is graet for normal approach I am trying to achieve the impossible ?

Just wondered if anyone had come up with a way of altering framework pages on the fly. Has been a long day and I may have missed something.

Thanks

Mark




Rick Strahl
West Wind Technologies

Making waves on the Web

from Maui, Hawaii
HTML Help Builder

Viewing all articles
Browse latest Browse all 10393

Trending Articles