Combining ASP:Repeater and JQuery
<p>I have the next C# code (which works):</p>

<pre><code>    // Write data into the checkboxes
    RepeaterVocabularyWords.DataSource = new[] { correctWord1, correctWord2, incorrectWord1, incorrectWord2 };
    RepeaterVocabularyWords.DataBind();  

    // Get data from the checkboxes
    protected void ButtonAccept_Click(object sender, EventArgs e)
    {
                    foreach (RepeaterItem item in RepeaterVocabularyWords.Items)
        {
            if (item.ItemType == ListItemType.Item
                || item.ItemType == ListItemType.AlternatingItem)
            {
                CheckBox CheckBoxVocabularyWord = (CheckBox)item.FindControl("CheckBoxVocabularyWord");
                if (CheckBoxVocabularyWord.Checked)
                { 
                }
            }
        }
</code></pre>

<p>And the next ASP with JQuery code (which works):</p>

<pre><code>$(document).ready(function () {
    $("input[id$='ButtonAccept']").click(function (e) {
        if ($('span.storeCheck input:checked').length != 2) {
            alert("You have to choose only the 2 words that means the same!");
            e.preventDefault();
}
</code></pre>

<p>Then, if I write the line "span class="storeCheck"..," the above repeater code works, but not the above c# code:</p>

<pre><code>&lt;asp:Repeater ID="RepeaterVocabularyWords" runat="server" OnItemCommand="Repeater1_ItemCommand"&gt;
    &lt;ItemTemplate&gt;            
        &lt;&lt;span class="storeCheck"&gt;&lt;input runat="server" type="checkbox" ID="CheckBoxVocabularyWord" title="&lt;%# Container.DataItem %&gt;" /&gt;&lt;/span&gt;  
    &lt;/ItemTemplate&gt;
&lt;/asp:Repeater&gt;
</code></pre>

<p>On contrast, if I write "asp:CheckBox ID="..," the above c# code works, but not the Jquery stuff.</p>

<pre><code>&lt;asp:Repeater ID="RepeaterVocabularyWords" runat="server" OnItemCommand="Repeater1_ItemCommand"&gt;
    &lt;ItemTemplate&gt;  
        &lt;asp:CheckBox ID="CheckBoxVocabularyWord" runat="server" Text="&lt;%# Container.DataItem %&gt;"   /&gt;    
    &lt;/ItemTemplate&gt;
&lt;/asp:Repeater&gt;
</code></pre>

<p>How could I make both work?</p>

<p>Thanks for any help! :)</p>

<p>Carlos</p>
