Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataBound Drop Down List

Thread Tools

DataBound Drop Down List

Posts: n/a
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!


Reply With Quote
antelopepiledriver antelopepiledriver is offline
Junior Member
Join Date: Jul 2007
Posts: 1
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>
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
databound Drop Down List not changing on new selection KROSS General Computer Support 0 01-21-2008 04:48 PM
Drop down list error: "Databinding methods such as Eval(), XPath(),and Bind() can only be used in the context of a databound control." ASP .Net 0 12-13-2007 02:00 PM
retrive preselected value in second drop down list from the first drop down list weiwei ASP .Net 0 01-05-2007 07:29 PM
Acting on contents of a declartivly databound Drop Down List? mc ASP .Net Building Controls 1 06-26-2006 03:56 AM
Auto Drop down a Drop Down List Javascript 5 11-23-2005 01:35 AM