Example
Source
Run as server control
Linked dependent combos can be easily created using the
addLinkedCombo
method.
Customer
Order Date
Product (Qty)
Include the Javascript library file
<script src="../dbnetcombo.js"></script>
Client-side script
window.onload = initialise ////////////////////////////////////////////////////////////////////////////////////////////// function initialise() ////////////////////////////////////////////////////////////////////////////////////////////// { customerCombo = new DbNetCombo("customers") orderCombo = new DbNetCombo("orders") productCombo = new DbNetCombo("products") with ( customerCombo ) { connectionString = "samples" sql = "select customerid,companyname from customers order by companyname" addLinkedCombo( orderCombo, "customerid" ) } with ( orderCombo ) { connectionString = "samples" sql = "select orderid,orderdate from orders where customerid = @customerid" dateFormat = "D" addLinkedCombo( productCombo, "orderid" ) } with ( productCombo ) { connectionString = "samples" sql = "select '', productname & ' (' & quantity & ')' " + "from products, [order details] " + "where products.productid = [order details].productid " + "and orderid = @orderid" } customerCombo.load() }
HTML
<table> <tr style='font-weight:bold'> <td>Customer</td> <td>Order Date</td> <td>Product (Qty)</td> </tr> <tr> <td style='vertical-align:top'> <select id="customers"></select> </td> <td style='vertical-align:top'> <select id="orders"></select> </td> <td> <select size=5 id="products"></select> </td> </tr> </table>