Tornado API Library - V12.30.08

z.dbSendHead Property

Include user text in the <HEAD>..</HEAD> block.

Product Version

All
[VisualBasic]
PublicPropertydbSendHeadAsString
[C#]
publicstringdbSendHead{set;}

Property Value

Obj.dbSendHead = "HTML Code"

QuickProp Keyword Abbreviation

sh

Remarks

Example

This is an advanced example in sending the entire JS to the head.

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
'------------------- User defined Javascript code -----------------
   Dim Js As String = vbCrLf & "<!-- Beginning of Java Functions -->" & vbCrLf
   Js &= "<" & "script language=""javascript"">" & vbCrLf
   Js &= "function TwoFields(pval) {" & vbCrLf
   Js &= "var val = new String(pval);" & vbCrLf
   Js &= "if (isNaN(pval)) {" & vbCrLf
   Js &= "   document.write(""#Error#"");" & vbCrLf
   Js &= " } else {" & vbCrLf
   Js &= "   var pos=val.indexOf(""."");" & vbCrLf
   Js &= "   var dec=((pos>-1)?""""+val.substring(pos,pos+3):"".00"");" & vbCrLf
   Js &= "   var sign=(val.charAt(0)==""-"")?""- "":"""";" & vbCrLf
   Js &= "   var val=""""+Math.abs(parseInt(val));" & vbCrLf
   Js &= "   var len=val.length;" & vbCrLf
   Js &= "   var temp="""";" & vbCrLf
   Js &= "   if (dec.length==2) dec+=""0"";" & vbCrLf
   Js &= "   if (dec.length==1) dec+=""00"";" & vbCrLf
   Js &= "   if (dec=="""") dec += "".00"";" & vbCrLf
   Js &= "   for (var k = 1; k <= len; k++) {" & vbCrLf
   Js &= "    temp=((k%3)==0)&&(k!=len)?("" ""+val.charAt(len-k)+temp):(val.charAt(len-k)+temp)" & vbCrLf
   Js &= "   }" & vbCrLf
   Js &= "   document.write(sign + temp + dec);" & vbCrLf
   Js &= "}}" & vbCrLf
   Js &= "</" & "script>" & vbCrLf
   Js &= "<!--  End of Java Functions -->" & vbCrLf

'------------------------ ASPdb.Net Code ------------------
   Dim Jsc As New Tornado.Z()
   With Jsc
      .dbQP="U=2| S=13| D=NWIND"
      .dbSQL = "Select ProductName,UnitPrice,UnitsInStock,'extra' FROM Products"
      .dbNameMap = "field=3|alias=Show 2 <BR> formatted <BR> fields"
      .dbGridMagicCell = "field=3|Macro=Price = <" & "script language=""JavaScript"">" & _
        "TwoFields('#1#')</" & "script><BR>Stock = <" & "script " & _
        "language=""JavaScript"">TwoFields('#2#')</" & "script>"
      .dbSendHead=Js
      .dbTextHolder="Title= MagicCell with Embedded Javascript"
      .ASPdbNet()
   End With
End Sub
</script>

See Also

z Class | Tornado Namespace | dbNoHead | ASPdbHead | Special Topic - Multiple Modules