dropdownlist for a table field that is not required

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
 
A

alex bowers

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top