Click here to Skip to main content
   

C#

 
QuestionHow to get the select value in a multiple dropdownlist Pinmembervanilsonwdd14-Jan-13 14:20 
hi, I'm trying to get multiple values that was selected in a dropdown list, the problem is that it's only returning one value, if I select two or more values only give me one, here's the code:
List<String> dep = new List<String>();
        foreach (ListItem item in sltnamedep.Items)
        {
 
            if (item.Selected)
            {
 

                
                dep.Add(item.Text);
 

            }
 
        }
        for (int i = 0; i < dep.Count; i++)
            Response.Write(dep[i]);

AnswerRe: How to get the select value in a multiple dropdownlist Pinmemberjibesh14-Jan-13 15:33 
AnswerRe: How to get the select value in a multiple dropdownlist Pinmembermicke.andersson28-Jan-13 4:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.150129.1 | Last Updated 30 Jan 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid