Step 13 - Binding the Order Edit Form
In this step you will bind Web Form controls on the Order Edit page to business objects, and test out the retrieval of selected orders.
Binding Text Boxes
- Select the Order Edit form in design mode, and then select all text boxes:

- Go to the Properties Window and select the BindingSource property. Doing this displays an ellipses button next to the property:

Note: For details on TextBox and other simple control binding properties, check out the MM .NET Help topic Data Binding Simple Bound Web Forms Controls. - Click the BindingSource ellipses button which launches the Binding Source Selection dialog. You should see the four business objects you previously registered with the form:

- Since we want to bind all text boxes to the Order business object, make sure the Order business object is selected in the dialog, then click the OK button. This automatically inserts the text Order in the BindingSource property of all selected Web controls:

This binds all selected controls to the Orders business object at run time.
- Now that you've set the BindingSource property for all these controls, you need to set the BindingSourceMember individually for each text box.
Click directly on the form to deselect all text boxes, and then select the Order ID text box. Go to the Properties Window and select the BindingSourceMember property. Click the associated ellipses button to launch the Binding Source Member dialog:

Make sure the Entity Framework radio button is selected at the bottom of the dialog.
- Since we want to bind this text box to the OrderID property of the entity associated with the Order business object, select Order in the Business Objects list on the left, and OrderID in the Entity Properties list on the right and then click OK to close the dialog. This displays the text OrderID for the BindingSourceMember property in the Properties Window.
Note: The Binding Source Member dialog is provided as a convenience for selecting binding information. If you already know the member you want to bind to, you can just type it directly in the BindingSourceMember property in the Properties Window. - Next, perform the same steps to set the BindingSourceMember property for all text boxes listed in the following table:
Text Box BindingSourceMember Name ShipName Address ShipAddress City ShipCity Region ShipRegion Postal Code ShipPostalCode Country ShipCountry Freight Freight - In this step, you'll set up the Shipper combo box, which needs to display a list of all shippers in the database. To do this, first select the combo box in design mode.
- Select the BindingSource property in the Properties Window. Click the associated ellipses button and in the Binding Source Selection dialog select Shipper and then click the OK button. This binds the Shipper combo box to the Shipper business object.
- Next, we need to specify the Shipper property that is used to display items in the combo box. To do this, select the BindingSourceDisplayMember property in the Properties Window. Click the associated ellipses button and select the Shipper business object in the Business Objects list on the left. In the Entity Properties list on the right, select the CompanyName property, and then click OK to close the dialog.
- Now you need to specify the Shipper property that determines the value of items in the combo box. To do this, select the BindingSourceValueMember property in the Properties Window. Click the associated ellipses button and select the Shipper business object in the Business Objects list. In the Entity Properties list, select the ShipperID property, and then click OK to close the dialog.
- Now, you need to set two more properties that data drive the SelectedValue property of the combo box. First, select the BindingValueSource property in the Properties Window. Click the ellipses button and select Order in the Binding Source Selection dialog. Next, select the BindingValueSourceMember property and click its ellipses button. Select the Order business object and the ShipVia property and click OK to close the dialog.
At this point, the binding properties in the Properties Window should look like this:

- In this step you need to set up the Employee combo box, following similar steps as you did when setting up the Shipper combo box. Assuming you know what you're doing now, you need to set the Employee combo box properties to the following values:

- Next, you need to set up the data binding for the Order Detail data grid. As with the Orders data grid, you only need to set the BindingSource, but this time to the OrderDetail business object:

- Since we don't want the user to change the order ID value, make sure the Order ID text box is selected, then go to the Properties Window and set the value of the ReadOnly property to True. At run time, if a text box is read-only, the user cannot change its value, and MM .NET does not try to bind the value of the control back when saving data.
Although we haven't completely finished setting up our data logic (we still need to add code to the form that edits and updates Order Detail), you are ready to run the form and retrieve an order.
See also:
Step 14 - Running the Order Edit Form
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic
