JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Binding Data to Controls

The DataBinding example on the CD-ROM shows how to perform data binding, both simple and complex. As you can see in Figure 21.3, this example uses a number of different data-bound controls; in this case, we're binding to the authors table of the SQL Server example pubs database.


Figure 21.3: The DataBinding example.

All I'm doing here is using simple and complex data binding as we've already seen. In this case, I've created a dataset, DataSet11, and filled it with data from the authors table in the pubs database, and bound it to various controls. For example, I've bound the Text property of the text box at upper left to the authors.au_lname field, the Checked property of the checkbox to the authors.contract field (which is a field of type Boolean, holding True/False values), the Text property of the radio button to the authors.au_lname field, the entire authors table to the data grid at upper right, the DisplayMember of the list box to the authors.au_lname field, and so on.

This works fine, and you'll see the data you've bound to the various controls when you run the program, but there's a problem—the simple-bound controls such as text boxes only display one data item (for example, the current author's last name) at a time. How can the user move to the next record?

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor