Cascaded DropDownLists

This example shows how to use Autopostback attribute to make cascaded dropdown lists. This Dataform does not base on any table and just shows some related data in three dropdown lists. When you pick a item from Employee dropdown list, the Orders dropdown list is then populated according to the picked Employees. Pick an item from Orders dropdown list to populate Order Details dropdown list.

Pick a Theme:

EmployeeOrdersOrder Details

  Design   Source  
  1. Open DataForm.NET Manager. In DataForm.NET List page, choose CascadedDropDownLists by clicking the link.
  2. In the DataForm.NET Designer on the right hand side, the default tab is DataForm tab.
  3. To set up Employee field, click Employee link to open up DataForm Field Designer window. Select DropDown List for Control Type; Check on the AutoPostBack checkbox and choose Orders field in the Associated Fields listbox, which means when Employee dropdown list posts back, it will refresh Order dropdown list; Switch to DataSource tab underneath. Since we are going to display the employee's full name, we combine lastname and firstname fields together in the SQL Expression and give it a alias name, FullName. Enter FullName for Data Text Field and EmployeeID for Data Value Field.
  4. To set up Orders field, click Orders link at the left side list. Select Dropdown List for Control Type; Check on the AutoPostBack checkbox and choose Order Details field in the Associated Fields listbox, which means when Order dropdown list posts back, it will refresh Order Details dropdown list; Switch to DataSource tab underneath. Specify the Data Text Field and Data Value Field according to the SQL Expression.
  5. To set up Order Details field, click Order Details link at the left side list. Select Dropdown List for Control Type; Switch to DataSource tab underneath. Specify the Data Text Field and Data Value Field according to the SQL Expression.
  • Click HERE to open up a READ ONLY DataForm.NET Manager.
  • Click HERE to try for yourself.