Solved

Why won't my multi select work?

Posted on 2014-01-16
7
313 Views
Last Modified: 2014-01-16
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" 
          runat="server" 
          AppendDataBoundItems="True" 
          DataSourceID="Authors_ds" 
          DataTextField="Authorame"  
          SelectionMode="Multiple" 
          AutoPostBack = "true">
    <asp:ListItem Text="Select Authors" Value="~Select Author~" />    
    </asp:DropDownList>           
     

Open in new window

0
Comment
Question by:programmher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 3

Expert Comment

by:13Shadow
ID: 39785456
Is your DataTextField supposed to be "Authorame"  or Authorname or AuthorName?

When you say it is not working what exactly is it not doing?
0
 

Author Comment

by:programmher
ID: 39785483
13Shadow,

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.
0
 
LVL 3

Expert Comment

by:13Shadow
ID: 39785508
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 19

Accepted Solution

by:
Amandeep Singh Bhullar earned 175 total points
ID: 39785551
Hi, i don't think drow down list will be able to provide this functionality

The property added
SelectionMode="Multiple"
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
0
 

Author Comment

by:programmher
ID: 39785785
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?
0
 

Author Comment

by:programmher
ID: 39785861
Aman,

I changed my code to this:

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



<asp:ListBox runat="server" 
DataSource="Authors_ds" 
DataTextField ="AuthorName" 
ID = "AuthorList" 
SelectionMode="Multiple" 
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.
0
 

Author Comment

by:programmher
ID: 39785921
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.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question