dropdownlist for a table field that is not required

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I'm using dropdownlist in a datagrid to allow a column in a table to be
edited. The dropdownlist contains several the from "dictionary/
code-decode" table. These columns are NOT required in the underlying table.
What is the best way to allow a user to leave the drop down list unselected?
Or is there another approach I should be taking?

Thanks in advance.

Mark
 
Hi Mark,
when I've needed to add dropdown lists in the past that
let the user select blank items there are a couple of
techniques I've used.
The first is to manually add a blank item to the
dropdownlist after you've databound it to the datasource -
which can be slightly awkward in that you can't write
this code in the Item_DataBound event for your datagrid
because the data won't have been bound yet. But still do-
able.
The other way it to force a blank record into the
recordset that populates the dropdownlist. If you have
some rows that contain blank values for that column then
a SELECT DISTINCT(colname) should bring back a blank row
which you can then bind to.

hope this helps,
alex
 
Back
Top