Web Connection only supports two kinds of special embedded script tag formats:
For example don't use:
HTML requires that expressions get embedded into the page with quotes and Web Connection will use double quotes for any embedded expressions it generates. This means your expression syntax should not use double quotes (") as string delimiter and instead use either square brackets([ ]) or single quotes (' '). <% if(Tquery.Status = "Completed" %> but use <% if TQuery.Status = [Completed] %>.
Typical examples:
<%= this.Page.oBusiness.oData.Title %> <%= this.Page.SomeStringReturningMethod() %> <%= TCursor.SomeField %>
These expressions can be embedded into page in place of any literal content. You can also use them inside of template controls like the wwWebRepeater Item Template for example.
Note that you cannot use <%= %> expressions inside of quoted attributes of controls, so the following does not work:
<ww:wwWebTextBox runat="server" id="txtName" Text="<%= TCursor.Name %>" />
Assignment to controls at runtime can be made either directly via code (this.txtName.Text = TCursor.Name from OnLoad or other event code) or by databinding via ControlSource:
<ww:wwWebTextBox runat="server" id="txtName" ControlSource="TCursor.Name" %> />
and you can then call either the Page's DataBind() method or the control's DataBind() (this.txtName.DataBind() ) method via code.
However, there's one common usage pattern that is supported: Conditional display of content by using a conditional <% if %> block. The need to conditionally display a block of content is so frequent that an exception is built into the Web Connection framework to simplify displaying conditional content more easily using the <% if Expression %> <% endif %> syntax. Here's a short example:
<% if this.Page.oBusiness.oData.LastAccess > Date() - 5 %> Some more text and controls hereSome text in my script page here
Common content: <ww:wwWebLabel runat="server" ControlSource="this.Page.oBusiness.oData.Content" />
<hr>
<% endif %>
The Web Control framework actually turns the conditional <% if %> expression into a wwWebPanel control with an invisible border. If the expression is false, the control is not rendered. The above actually is turned into:
<ww:wwWebPanel runat="server" VisibleExpression="this.Page.oBusiness.oData.LastAccess">
Common content: <ww:wwWebLabel runat="server" ControlSource="this.Page.oBusiness.oData.Content" />
<hr>
</ww:wwWebPanel>
Note that you can also use the wwWebPanel directly if you choose.
Also note that <% else %> is not supported. If you need an else condition you will need to explicitly define another < % if %> block with the negated expression in it. For example:
<% if this.Page.oBusiness.oData.LastAccess > Date() - 5 %>
Common content: <ww:wwWebLabel runat="server" ControlSource="this.Page.oBusiness.oData.Content" />
<hr>
<% endif %>
<% !if this.Page.oBusiness.oData.LastAccess > Date() - 5 %>
Display something else...
<hr>
<% endif %>