Tornado API Library - V12.30.08

z.dbSelectedItem Property

Special application to return select item and qty of grid.

Product Version

All
[VisualBasic]
PublicReadOnlyPropertydbSelectedItemAsObject
[C#]
publicobjectdbSelectedItem{get;}

Property Value

Dim OneDimension() As String = Obj.dbSelectedItem()

Dim TwoDimension(,) As String = Obj.dbSelectedItem()

QuickProp Keyword Abbreviation

N/A

Remarks

Setup for a special grid index column as checkboxes. The items checked can be retrieved via the dbSelectedItem read property. During the processing of the dbSelectedItem(), you must know whether the returned array is 1D or 2D. You can also input -ve quatntities values.

Return 1D array for selecteditmes and 2D array for selecteditem and quantity.

Example

See dbSelectedItemMacro for a 1-Dim example.

The following is a 2-Dim example retriving 'SelectedItems' and 'Qty'.

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim GD As New Tornado.GetData
  Dim Sitem2 As New Tornado.z
  With Sitem2
      .dbUnit = "34"
      .dbSkin = 5
      .dbMode = "Grid"
      .dbDSN = "NWIND"
      .dbSQL = "SELECT Productid, ProductName, UnitPrice FROM Products " & _
        "where discontinued =false and unitprice > 0"
      .dbGridMagicCell = "field=2|tag=align=right|macro=#2:currency#"
      .dbNameMap = "field=0|alias=Id|formula=ProductId; field=2|alias|Price|formula=UnitPrice"
      .dbSelectedItemMacro = "macro=#1#:#2# | Qtycol=true | Caption=Qty | Size=3 |" & _
        "Buttons=true | Raw=true"
      .dbTextHolder = "Title=2D SelectedItem Demo"
      .ASPdbNET()
  End With
  '-------------- User code to build shopping basket ----------------
  If GD.Get_SelectedItem <> Nothing Then
      Dim c, r As Integer
      Response.Write("<hr><Center><H3>Your Shopping Basket has" & _
        "...</H3><TABLE class=TS cellspacing='1'><TR><TD>" & _
        "Item</TD><td class='GH'>Product</td><td class='GH'>Qty" & _
        "</td><td class='GH'>Unit Price</td><td class='GH'>" & _
        "Sub-Total</td></tr>")
      Dim a(,) As String = Sitem2.dbSelectedItem()
      Dim subtotal, total As Double
      Dim p() As String
      If Not (IsNothing(a)) Then
          For r = 0 To UBound(a, 2)
              p = Split(a(0, r), ":")
              subtotal = CDec(p(1)) * Val(a(1, r))
              total += subtotal
              Response.Write("<tr><td>" & r + 1 & "</td><td>" & _
                p(0) & "</td><td>" & a(1, r) & "</td><td align=" & _
                "right>" & p(1) & "</td><td align=right>" & " & _
                "Format(subtotal, "currency") & "</td></tr>")
          Next r
          Response.Write("<tr><td colspan=4 align=right>Total</td><td align=" & _
          "right>" & Format(total, "currency") & "</td></tr>")
          Response.Write("</table><p><hr>")
      End If
  End If
End Sub
</script>

See Also

z Class | Tornado Namespace | dbSelectedItemMacro | dbShowDeleteStatus