| dbSelectedItem | dbSelectedItemMacro |
Setup for a special grid index column as checkboxes. The items checked can be retrieved via the dbSelectItem read property.
There are two properties to perform “shopping
cart” type applications.
1. X.dbSelectedItemMacro=(;,)Fld String Macro,Qty_T/F,Column_Caption,Input_Size, AuxButtons
Fld string macro =
Export
string with embedded field raw values.
QtyT/F = Qty
column next to CheckBox (True/False) Def=True
Column_Caption = Caption for QtyT/F Def="Qty"
Input_Size =
SIZE of the input box Def=5
AuxButtons =
Show the Clearall (c) and Checkall (x) buttons.
e.g. ”#1# #field2#“
would export field 1 and 2 separated by a space.
2. dbSelectedItem(Optional delimiter As
String)
delimiter is the user
preferred single character delimiter
case 1 : MyString=dbSelectedItem("+")
Returns a string is returned with the "+" as delimiter
It is recommended that the single delimiter character should be a non-displayable character. If omitted, then chr(1) will be used.
case 2 : MyArray=dbSelectedItem("array,+")
Returns an array
holding the selections is returned with the "+" as delimiter.
http://www.aspdb.com/Site/classic/CaseStudy/C43/case_study43.html
This special export is enabled ONLY if the
dbSelectedItemMacro is not blank. Note that the regular Index “#” header is
replaced by a “Select” button. Whenever a choice is made, the “Select”
button must be clicked to submit the changes. Checking and unchecking the
checkbox(s) are both considered as changes. Once the record is checked, the
check will stick to the record even after a sort. One way to reset the
checkboxes is to “Reload”. Checkout the get property X.dbSelectedItem.
| Property Syntax |
| Property | Syntax | Description |
| dbSelectItem(delimiter) | This read property retrieves the Selected Items onto a string delimited by the optional delimiter. The default delimiter is chr(1). User can then extract the items off this string for further processing. | |
| dbSelectItemMacro | MagicCellMacro String | Define the Selected items format according to the MagicCell macro. |
| Example |
| <!-- #include File=AspDB.Inc --> <% Set X= Server.CreateObject("ASP.DB") X.dbUnit = 1 X.dbMode="Grid" X.dbDSN = "NWIND" SQL="SELECT Customers.CustomerID, CompanyName, OrderID FROM Customers " SQL=SQL & "LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID " SQL=SQL & "ORDER BY OrderID" X.dbSQL=SQL X.dbSelectedItemMacro="#0# #2#" X.dbUserLocalText=zSelect & ",Order" X.dbNavigationItem="top,bottom,prev,next" X.ASPDB response.write("<Center><B>My Selected Items are =" & X.dbSelectedItem("+") & "</B></Center>") %> |
![]() |