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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T23:39:47+00:00 2026-05-28T23:39:47+00:00

My checkboxlist contains 3 items A,B,C. If user checks A which is what i

  • 0

My checkboxlist contains 3 items A,B,C.
If user checks A which is what i want then user will obtain 2 marks
else user obtains 0 marks

My problem is that whenever user checks more than 3 item, user is still able obtain 2 marks, whereas by rights user should obtain zero marks because user checked A,B,C?

so how to make that if user has checked more than 1 box in checkboxlist then user will obtain 0 marks

example

if(A==A){
    //user obtain 2 marks
}else{
    //user obtain 0 marks
}

dtr = cmd.ExecuteReader();

if (dtr.Read())
{
    if (dtr["Answer"].ToString() == CheckBoxList1.Text.ToString())
    {
        Label2.Text = "2 marks";
    }
    else
    {
        Label2.Text = "0 marks";
    }
}
else
{
    Response.Write("db not read");
}

dtr.Close();
  • 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-28T23:39:48+00:00Added an answer on May 28, 2026 at 11:39 pm

    well, i figured out the answer, thanks for help=) every checked the numSelected will increase by 1,once numSelected more then 2,user will get 0marks

    int numSelected = 0;
    
    foreach (ListItem li in CheckBoxList1.Items)
    {
        if (li.Selected)
        {
            numSelected = numSelected + 1;
        }
    }
    
    Response.Write("Total Number Of CheckBoxes Selected:");
    
    Response.Write(numSelected);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Web User Control that contains a CheckBoxList. MyListControl: <asp:checkboxlist id=chkList runat=server>
i'm using AJAX to make a user control which contains a panel that contains
I've got a CheckBoxList control that I want to require the user to check
I have an asp.net panel that contains a checkboxlist. I'd like to resize it
i have a CheckBoxList with a list of services that the user can execute...
The following code: If checkboxList.Items(i).Selected Then .Fields(DESC1).Value += checkboxList.Items(i).Text + , End If should
I've got search form, which contains checkboxlist which is binded to my model. So
I have a FormView (bound to an ObjectDataSource) that contains a CheckBoxList that I'd
How do I specify that I want two columns on a checkboxlist? Below is
I have a checkboxlist.When I check one the value will appear in a table.Now

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.