Tornado Class Library

Special Topic - Memo Fields

There are several options to treat memo fields -

Mydb.dbMemoFlds="Field| Field| Raw"
Mydb.dbPopText = "WinProp | WinName | LinkText | Skin"
Mydb.dbMagicCell = "f=MemoFieldName | mac=#poptext#"
Mydb.dbMemoTextSize = 128

 

Basic Memo field

This basic example has 1 memo field (Notes) in the query. No treatment is specified therefore only the word 'Memo' is displayed in the cell.

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim Mydb As New Tornado.z
  With Mydb
    .dbQP = "U=2| M=Grid| S=2| DSN=Nwind| gdf=0,1,2,Notes| Q=Employees| Th=Title=Memo Field"
    .ASPdbNET()
  End With
End Sub
</script> 

 

Display Memo field in Cell

Next we display the first 50 characters of memo field in the cell. Note that the display rounds off the end o fth eline to the nearest word and append a "..." to indicated a partial display.

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
  Dim Mydb As New Tornado.z
  With Mydb
    .dbQP = "U=2| M=Grid| S=2| DSN=Nwind| gdf=0,1,2,Notes| Q=Employees| Th=Title=Memo Field"
    .dbMemoTextSize = 50
    .ASPdbNET()
  End With
End Sub
</script>

 

Display Memo field in a separate Grid

Now, since there is only one memo field, we'll use the dbMemoFlds to display the memo below the table. In order to change record so we can see the associated memo field, we add a grid index for navigation. dbMemoTextSize must be specified and is usually set to -1 to display the entire memo.

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim Mydb As New Tornado.z
  With Mydb
    .dbQP = "U=2| S=2| DSN=Nwind| gdf=0,1,2| Q=Employees| TH=Ti=One Memo Field"
    .dbMode = "Ty=grid| SysInd=t"
    .dbMemoFlds = "Fi=Notes| Ti=Employee Background"
    .dbMemoTextSize = -1
.ASPdbNET()
  End With
End Sub
</script> 

 

PopUp Text and Memo fields

Now we' use a popup window to display the memo text as well as regular text. Note that all fields can be popped and not just memo field even though memo field makes the most sense. Since the  memo can be viewed via the popup from the cell, we do not need any grid row index for navigation. The linked image is in the /tornado/images-dir. Note that the application and popup skin can be different as the popup is actually a separate application.

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
  Dim Mydb As New Tornado.z
  With Mydb
    .dbQP = "U=2| M=Grid| S=2| DSN=Nwind| gdf=0,1,2,Notes| Q=Employees| TH=Title=PopUp Text and Memo"
    .dbMagicCell = "f=firstname| mac=#poptext#"
    .dbPopText = "Skin=Plain| LinkText = <IMG border=0 SRC='/tornado/images-net/search.gif'>..."
    .ASPdbNET()
  End With
End Sub
</script> 

 

Display Memo fields using a Template

We really have full control is how to display the memo field in conjunction with the grid. The following  is the Memo Template -

Memo template - [[memo::FieldName::HTML code]]

Example -

[[memo::_fieldname::<table width='54%' class=ts cellspacing='1'><tr><td class='gh'>
header</td></tr><tr><td class=nr>##field##</td></tr></table></center>]]

Nom, We'll add the the memo template to the Grid template -

Obj.dbGridTemplate = "<center>[[Grid]]<p>[[GridNav]]<P>[[GridStat]]<P>
[[memo::Notes::<table width='54%' class=ts cellspacing='1'><tr><td class='gh'>Employees Notes</td></tr>
<tr><td class=nr>##field##</td></tr></table></center>]]"

The final code will be -

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim Mydb As New Tornado.z
  With Mydb
    .dbQP = "U=2| M=Grid| S=2| DSN=Nwind| gdf=0,1,2| Q=Employees| TH=Title=PopUp Text and Memo"
    .dbMemoTextSize = -1
    Dim Gt As String = "<center>[[Grid]]<p>[[GridNav]]<P>[[GridStat]]<P>[[memo::Notes::"
    Gt &= "<table width='54%' class=ts cellspacing='1'><tr><td class='gh'>Employees Notes"
    Gt &= "</td></tr><tr><td class=nr>##field##</td></tr></table></center>]]"
    .dbGridTemplate = Gt
    .ASPdbNET()
  End With
End Sub
</script> 

This example illustrates that you can place the memo field anywhere you want.

 


Send comments on this topic.
Copyright 1998-2006 ASP-db