| 1. |
How Do You Display An Editable Drop-down List? |
|
Answer» Displaying a drop-down LIST requires a template column in the grid. Typically, the ItemTemplate CONTAINS a control such as a data-bound Label control to show the current value of a field in the record. You then add a drop-down list to the EditItemTemplate. In Visual Studio, you can add a template column in the Property builder for the grid, and then use standard template editing to remove the default TextBox control from the EditItemTemplate and drag a DROPDOWNLIST control into it instead. ALTERNATIVELY, you can add the template column in HTML view. After you have created the template column with the drop-down list in it, there are two tasks. The first is to populate the list. The second is to preselect the appropriate item in the list � for example, if a book�s genre is set to �fiction,� when the drop-down list displays, you often want �fiction� to be preselected. Displaying a drop-down list requires a template column in the grid. Typically, the ItemTemplate contains a control such as a data-bound Label control to show the current value of a field in the record. You then add a drop-down list to the EditItemTemplate. In Visual Studio, you can add a template column in the Property builder for the grid, and then use standard template editing to remove the default TextBox control from the EditItemTemplate and drag a DropDownList control into it instead. Alternatively, you can add the template column in HTML view. After you have created the template column with the drop-down list in it, there are two tasks. The first is to populate the list. The second is to preselect the appropriate item in the list � for example, if a book�s genre is set to �fiction,� when the drop-down list displays, you often want �fiction� to be preselected. |
|