Get only property. Special application to return select item and qty of grid in 1 or 2 dim array.
Version: All
Namespace:
TornadoAssembly: Tornado (in Tornado.dll) Version: 12.6.0.9 (1.0.0.0)
Syntax
| C# |
|---|
public Object dbSelectedItem { get; } |
| Visual Basic (Declaration) |
|---|
Public ReadOnly Property dbSelectedItem As Object |
Field Value
Dim OneDimension() As String = Obj.dbSelectedItem()Dim TwoDimension(,) As String = Obj.dbSelectedItem()
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.
Examples
See dbSelectedItemMacro for a 1-Dim example.
CopyVB.NET
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 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 Sitem2.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>