Tuesday, March 6, 2012

Orders: Changing Field to Drop Down List

There are only three shipping companies in the Northwind database. By default, the web application generator renders the ShipVia field as a lookup.

Ship Via Company Name lookup

A lookup is very useful when there is a long list of options, as it offers sorting, filtering, and quick find. In this situation, the lookup is just a hindrance to the user. Let’s change this lookup to a drop down list.

Go back to the Designer, and expand to the Order Form \ c100 \ dv100 \ editForm1 \ c1 – Orders \ ShipVia node. Double click on ShipVia field, and scroll down to the Lookup section. Change the following settings:

Property Text
Items Style Drop Down List
Data Value Field ShipperID
Data Text Field CompanyName

Items Style 'Drop Down List' in Code On Time Designer

Press OK to save. Press Generate, and wait for the page to load. If you edit an order, you will see that Ship Via Company Name field is now a drop down list.

Ship Via Company Name data field as 'Drop Down List' in Code On Time Preview

No comments:

You can find more about Code OnTime Generator, Data Aquarium Framework, and other great products here.

© 2010 Code OnTime LLC. Intelligent code generation software for ASP.NET. Visit us at http://codeontime.com