Looping through datalist fails
<p>I need to process the selection from a datalist but the forech loop where I'm looping through the items in the datalist does not work. Basically if the checkbox is checked, I want to get the email address which is in the tooltip of the chekc box. The datalist count is zero. Can someone help me with this?</p>

<pre><code>&lt;ajaxToolkit:Accordion ID="Accordion1" runat="server" selectedIndex="0"  FadeTransitions="true" FramesPerSecond="40" TransitionDuration="250" SuppressHeaderPostbacks="true" HeaderCssClass="Header"&gt;
            &lt;Panes&gt;
                &lt;ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server"&gt;
                    &lt;Header&gt;
                            &lt;asp:LinkButton ID="lbtnSM" runat="server" Width="207px" Text="Users" Font-Bold="true"  CssClass="GeneralText"  /&gt;&lt;br /&gt;&lt;br /&gt;
                    &lt;/Header&gt;
                    &lt;Content&gt;
                        &lt;div class="emailleftcolumm"&gt;
                            &lt;asp:DataList ID="dlSM" runat="server" DataKeyField="ID" OnItemCommand="dlSM_ItemCommand" 
                                 EnableViewState="false" Width="207px" OnItemDataBound="dlSM_ItemDataBound"&gt;
                                &lt;HeaderStyle BorderWidth="1" BorderStyle="Inset" Font-Bold="true" /&gt;
                                &lt;HeaderTemplate&gt; 
                                   Select All &lt;asp:CheckBox ID="chkSelectAll" runat="server" /&gt;
                                &lt;/HeaderTemplate&gt;
                                &lt;ItemTemplate&gt;
                                    &lt;asp:CheckBox ID="chkSelector" runat="server" Text='&lt;%# Eval("firstname") + " " + Eval("lastname") + ", " + Eval("acronym") %&gt;' 
                                        CssClass="GeneralText" ToolTip='&lt;%# Eval("email") + ";" + Eval("altemail") %&gt;'/&gt;                                    &lt;/ItemTemplate&gt;
                                &lt;AlternatingItemTemplate&gt;
                                    &lt;div id="altbgcolor"&gt;
                                        &lt;asp:CheckBox ID="chkSelector" runat="server" Text='&lt;%# Eval("firstname") + " " + Eval("lastname") + ", " + Eval("acronym") %&gt;'  
                                            ToolTip='&lt;%# Eval("email") + ";" + Eval("altemail") %&gt;' CssClass="GeneralText" /&gt;                                        &lt;/div&gt;
                                &lt;/AlternatingItemTemplate&gt;
                            &lt;/asp:DataList&gt;
                        &lt;/div&gt;
                    &lt;/Content&gt;
                &lt;/ajaxToolkit:AccordionPane&gt;
</code></pre>

<p>The button click event handler looks like this:</p>

<pre><code>protected void btnSend_Click(object sender, EventArgs e)
    {
        string _mailto = string.Empty;
        string _subject = txtSubject.Text;
        string _message = txtMessage.Text;

        DataList DataList1 = (DataList)FindControl("DataList1");
        foreach (DataListItem item in DataList1.Items)
        {
            CheckBox chkSelector = (CheckBox)item.FindControl("chkSelector");
            if (chkSelector.Checked)
            {
                _mailto += chkSelector.ToolTip + ";";
            }
        }

        // do mail call

        // Clean up
        lblEmailConfirm.Font.Bold = true;
        lblEmailConfirm.Text = "Subject: " + _subject + " Message: " + _message;
        txtSubject.Text = string.Empty;
        txtMessage.Text = string.Empty;
    }
</code></pre>
