Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8007191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:44:51+00:00 2026-06-04T17:44:51+00:00

I have the next C# code (which works): // Write data into the checkboxes

  • 0

I have the next C# code (which works):

    // 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)
                { 
                }
            }
        }

And the next ASP with JQuery code (which works):

$(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();
}

Then, if I write the line “span class=”storeCheck”..,” the above repeater code works, but not the above c# code:

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

On contrast, if I write “asp:CheckBox ID=”..,” the above c# code works, but not the jQuery stuff.

<asp:Repeater ID="RepeaterVocabularyWords" runat="server" OnItemCommand="Repeater1_ItemCommand">
    <ItemTemplate>  
        <asp:CheckBox ID="CheckBoxVocabularyWord" runat="server" Text="<%# Container.DataItem %>"   />    
    </ItemTemplate>
</asp:Repeater>

How could I make both work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:44:52+00:00Added an answer on June 4, 2026 at 5:44 pm

    The approach of Ray I think would work, but it is what I did finally.

    The Jquery code is as follow:

    <script type="text/javascript">
        $(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();
                }
            });
        });
    </script>
    

    And the Repeater is:

    <asp:Repeater ID="RepeaterVocabularyWords" runat="server" OnItemCommand="RepeaterVocabularyWords_ItemCommand">
        <ItemTemplate>
            <span class="storeCheck">
                <asp:CheckBox ID="CheckBoxVocabularyWord" Font-Size="0px" runat="server" Text="<%# Container.DataItem %>"
                    ClientIDMode="Static" CssClass="{labelOn: '<%# Container.DataItem %>', labelOff: '<%# Container.DataItem %>', easing: 'easeOutBounce', duration: 500}" />
            </span>
        </ItemTemplate>
    </asp:Repeater>
    

    I’m writing a game. I’ll put the link here if I finally upload it somewhere 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the next code: js: $('[id^=check-]').change(function(){ var new_id = this.id.replace(/check/, 'new'), real_id =
I have next code require 'rack/rpc' class Server < Rack::RPC::Server def hello_world Hello, world!
I have the next code in javascript. I deleted some unnecessary items because it
I have the next code: Process p = Runtime.getRuntime().exec(args); and I want my program
I have the next code that was given to me to split up a
I have a next code in my view: <% @todos.each do |todo| %> <tr>
i have the next code: std::string line; std::ifstream myfile (text.txt); if (myfile.is_open()) { while
I have a next code: type THead = packed record znmpc: byte; znmpcch: array
I have this code require 'mechanize' @agent = Mechanize.new page = @agent.get('http://something.com/?page=1') next_page =
I have a fairly simple block of code. Sub Run(Name) on error resume next

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.