Sunday, April 15, 2012

Automatic Display of Lookups

In some situations, you may want to streamline selection of lookup values when users are entering or editing data. For this purpose, lookup fields in Code On Time web applications have the “Activate If Blank” property. If this property is enabled, whenever a user opens an edit view and the lookup is blank, then the lookup window will activate automatically.

Let’s use an example. Create a sample Northwind application. Select the project name on the start page, and press Design.

In the Project Explorer, switch to the Controllers tab. Double-click on Orders / Fields / CustomerID node.

CustomerID field in Code On Time Project Explorer

Scroll down and toggle the checkbox next to “Activate If Blank”.

'Activate If Blank' property enabled in Code On Time Designer

Press OK to save the field.

Enable “Activate If Blank” for EmployeeID and ShipVia fields using the same method. Make sure to save each field. These fields will be activated in the order of the data fields in the view.

Select Browse on the tool bar to generate and open the application in your default web browser. Navigate to the Orders page. On the action bar, press New Orders.

The Customer ID lookup will automatically be activated, as the field is blank.

CustomerID lookup window activated when the field value is blank

Select a customer, and the Employee ID lookup will pop up right away.

Employee ID lookup window activated when the field value is blank

When you select an employee, then the Ship Via lookup will appear.

Ship Via lookup window activated when the field value is blank

This behavior will occur when you edit or create order records that have blank lookup fields, including inline edit or new modes in grid views.

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