DataBound Drop Down List

Discussion in 'ASP .Net' started by thebison, Apr 23, 2006.

  1. thebison

    thebison Guest

    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
     
    thebison, Apr 23, 2006
    #1
    1. Advertising

  2. thebison

    antelopepiledriver

    Joined:
    Jul 16, 2007
    Messages:
    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>
     
    antelopepiledriver, Jul 16, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SirPoonga
    Replies:
    2
    Views:
    799
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,047
    weiwei
    Jan 5, 2007
  3. mc
    Replies:
    1
    Views:
    109
    Walter Wang [MSFT]
    Jun 26, 2006
  4. Randy Galliano

    Default Value in on Databound Drop Down list

    Randy Galliano, Nov 5, 2007, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    280
    Randy Galliano
    Nov 7, 2007
  5. Replies:
    5
    Views:
    295
Loading...

Share This Page