• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

Why won't my multi select work?

My multi-select list box is not working.  This is probably something simple.  I am making sure that I hold the CTRL key before I select the authors' names, too.  

Here is my code:

<asp:DropDownList ID="listAuthors" 
          AutoPostBack = "true">
    <asp:ListItem Text="Select Authors" Value="~Select Author~" />    

Open in new window

  • 4
  • 2
1 Solution
Is your DataTextField supposed to be "Authorame"  or Authorname or AuthorName?

When you say it is not working what exactly is it not doing?
programmherAuthor Commented:

The DataTextField is supposed to be AuthorName.

I am unable to select more than one author's name at a time.  

I can only select one author's name at a time.

 So, if 25 authors are displayed, I want to be able to select more than one author's name.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Amandeep Singh BhullarCommented:
Hi, i don't think drow down list will be able to provide this functionality

The property added
is not the ASP.net control property.

If you want to achive this then try using some other control like list items or give a try to example shared by 13Shadow

Hope this will help
programmherAuthor Commented:
I am trying to download the zip file but keep getting an error.

Do you have another link that I can use to download the example?

Aman, do you have a link to an example that uses list items?
programmherAuthor Commented:

I changed my code to this:

<asp:DropDownList runat="server" ID="lbGenreList" 
                 style="float:left;" DataSourceID="Genres" 
                 AutoPostBack="True" AppendDataBoundItems="true">

<asp:ListBox runat="server" 
DataTextField ="AuthorName" 
ID = "AuthorList" 
OnSelectedIndexChanged = "AuthorList_SelectedIndexChanged" />

Open in new window

This is my error:  The 'DataSource' property cannot be set declaratively.

What I need to happen is that the user selects their genre from the first dropdown box (ex: Horror).

The second list box displays all the authors names the library has who have written Horror books.  The users need to select one or more of the authors listed.
programmherAuthor Commented:
I changed my listbox to this and it resolved the error:

 <asp:ListBox runat="server" ID="AuthorList" DataTextField="AuthorName" 
            DataValueField="AuthorName" DataSourceID="Authors"  SelectionMode="Multiple"/>

Open in new window

      Thank you for your help.

My last step is to get the selected author (or authors) to update into my database.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now