DataBound Drop Down List

T

thebison

Hi all,

I hope someone can help with this relatively simple problem.
I am building a timesheet application using ASP.NET C# with Visual
Studio 2003.As it is only a protoype application, my database has been
made in MSDE.

My question is simple, on my Projects form I have a 'search' button,
which when clicked re-binds a datagrid with a RowFilter based on a
number of user-input parameters. Two of these parameters are drop-down
lists. The first is simply populated with a defined list of items. The
second is DataBound to show a list of managers from the managers table.
With the first drop down list I have set the 'selected item' by default
to be a blank record. This means that if the user chooses nothing, the
search will effectively ignore the drop-down. This is great. However,
with the DataBound drop-down list, I cannot do this. This means that
the user HAS to search by one of the managers. Subsequently, the user
cannot search on other criteria to return projects by ALL managers, as
one of them must be selected!..

Does anyone have any suggestions as to how I can get round this
problem, aside from creating a blank manager entry in the table, which
is obviously not ideal!

Many thanks!

Al
 
Joined
Jul 16, 2007
Messages
1
Reaction score
0
Add AppendDataBoundItems="true" property to the asp: DropDownList control and then add the default selected list item with an empty value like so <asp: DropDownList...AppendDataBoundItems="true"><asp: ListItem Value="" Selected="true">Select One!</asp: ListItem></asp: DropDownList>
 

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

Similar Threads

Not sure why drop-down is not working. 2
Z-Index/Drop-down menu issues 2
Drop Down List, AutoPostBack 1
Drop down list/menu 3
drop down list events 4
drop down list 6
Range / empty list issues?? 1
drop down list 1

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top