These items can
potentially be of any type??”say, Celebrity. The model's responsibility is to explain
to the component how exactly the objects should be displayed in the resulting
drop-down list.
When one of the options is selected by the user and the form containing the Select
component is submitted, the value parameter is used to pass the selected object to
the page class. Again, we need to somehow instruct the Select component how
exactly to retrieve a correct object based on the information available in the
drop-down list.
Also, when the Select component is displayed by a page, it checks if the page
property to which its value parameter is bound already has some value assigned to
it, and if it does, it uses that value to decide which of the available options should be
displayed as selected. Again, for a custom object, some instructions might be needed
on how exactly to do this.
Since the Select component is designed to be very flexible, and to work with any
custom class, it does require some additional instructions, as outlined above. We
didn't have to provide any of them before when using the Select component with
enumerations back in Chapter 4 because we used EnumSelectModel, which already
contains all the information on how to deal with enumerations, but only with them.
Pages:
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259