Checkbox list checked values
<p>I have a checkbox list with 3 items in it. I would like to get all the checked values of checkbox list into a single string. I tried the following code, but it does not give correct results.
Can anyone help me in this.</p>

<pre><code>&lt;asp:checkboxlist id="interestedIN" runat="server" repeatlayout="table"
    cellspacing="3" cellpadding="3" Font-Size="12px"&gt;
  &lt;asp:ListItem id= "social" runat="server"  text=" Sociology" Selected="false" /&gt;
  &lt;asp:ListItem id="zoo" runat="server"  text=" Zoology " Selected="false" /&gt;
  &lt;asp:ListItem id="math" runat="server"  text=" mathematics " Selected="false" /&gt;
&lt;/asp:checkboxlist&gt;
</code></pre>

<p>here is the C# i implemented:</p>

<pre><code>foreach (ListItem li in interestedIN.Items)
        {
            if (li.Selected)
            {
                interestIN = interestedIN.SelectedItem.Value + "," + interestIN;
            }
        }
</code></pre>

<p>Output: If user selects Sociology and Zoology, i would like to have the output as "Sociology, Zoology"
But my above code gives me following result "Sociology, Sociology".</p>
