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 7183683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:02:26+00:00 2026-05-28T18:02:26+00:00

I have a repeater where I have a column with checkboxes and one column

  • 0

I have a repeater where I have a column with checkboxes and one column with gender which i populate with database value.

I want to find out if user has selected multiple checkboxes of same gender e.g. male if so do something otherwise If a user selects multiple checkboxes with a mixture of male and female then do something else.

so far I was thinking to add this to a list and then see if list has same values but not sure if it is best idea here is my code (I have a hidden field to get gender ), I am running this on click event of a button:

 foreach (RepeaterItem rptItem in myrepeater.Items)
        {
            hiddenGender = rptItem.FindControl("hiddenGender") as HiddenField;

            if (Convert.ToInt32(hiddenGender.Value) == 0)
            {
                gender.Add(0);
            }
            else if (Convert.ToInt32(hiddenGender.Value) == 1)
            {
                gender.Add(1);
            }
            else if (Convert.ToInt32(hiddenGender.Value) == 2)
            {
                gender.Add(2);
            }
        }

ps without usage of linq as it is framework 2.0

  • 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-05-28T18:02:27+00:00Added an answer on May 28, 2026 at 6:02 pm

    got it, here is the code to maybe help others(first I get the first item and see if it matches next item) :

    public static bool ListEquality(IEnumerable<int> lstGender)
    {
        int? first = null;
        bool isUnique = true;
        foreach (var item in lstGender)
        {
            if (first == null)
            {
                first = item;
            }
            else if (first.Value != item)
            {
                isUnique = false;
            }
        }
        return isUnique;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an action column in my repeater which shows actions a user can
I have a repeater control outputting some HTML. I want a table which outputs
Good afternoon. I have a Repeater with a ItemTemplate that prints one column with
I have a repeater. And i want to hide and display a particular column
I have repeater and it gets a column value from modalpopup. I need to
I have a table where one column has duplicate records but other columns are
I have a repeater that has a LinkButton in one of its columns and
I have a repeater which binds a set of data. Within this repeater is
I have a asp:Repeater in one of my asp:GridView columns. In the template of
Hi have a repeater which is inside a gridview. when i bind the data

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.