Click here to Skip to main content
15,896,606 members
Home / Discussions / C#
   

C#

 
QuestionHow to get the select value in a multiple dropdownlist Pin
vanilsonwdd14-Jan-13 13:20
vanilsonwdd14-Jan-13 13: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:
C#
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 Pin
Jibesh14-Jan-13 14:33
professionalJibesh14-Jan-13 14:33 
AnswerRe: How to get the select value in a multiple dropdownlist Pin
micke.andersson28-Jan-13 3:54
micke.andersson28-Jan-13 3:54 

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

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