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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:28:13+00:00 2026-06-09T01:28:13+00:00

I have a code check the checkedlistbox checkboxes in asp.net/c#. foreach (ListItem item in

  • 0

I have a code check the checkedlistbox checkboxes in asp.net/c#.

foreach (ListItem item in cbxlFeatures.Items)
{
  foreach (DataRow row in dt.Rows)
    {
       if (item.Value.Equals(row["Id"].ToString()))
        {
          item.Selected = Convert.ToBoolean(row["Id"]); 
         // whenever this condition is met i need my 
         // loop to skip the remianing iterations and start with next one.

        }
         break;
     }
 }

Update

I think , I was not clear in my question. Say I have 1 to 10 ids in my datatable. Where 7,8,9 have value false and rest true. And this id is too displaying on the checkboxlist. Just my true / false values differs. So What i asked to check the condition and set the value t/f to the checkbox. And the loop will skip once the check box is set to checked.

  • 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-09T01:28:15+00:00Added an answer on June 9, 2026 at 1:28 am

    You can use keyword continue; as in below code

    foreach (ListItem item in cbxlFeatures.Items)
    {
      foreach (DataRow row in dt.Rows)
        {
           if (item.Value.Equals(row["Id"].ToString()))
            {
              item.Selected = Convert.ToBoolean(row["Id"]); 
    
              // this is what you need here
              continue;
            }
             break;
         }
     }
    

    if you have more question let me know.

    Thanks Ankur

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

Sidebar

Related Questions

Hi all I have this code to check if an item from a textbox
I have this code that will check the top level checkbox if the checkboxes
I have a DataBound CheckedListBox, I need to check some items on it. I
I have the following PHP code // Check if the upload is setted if
i have this code that will check the array contains the specific string and
I have this code that will check for if the class more-results are in
I have this piece of code which check the last customer_id from the db.
I have this code to set up and check a cookie, and before a
I have this code : String check=SELECT COUNT(*) as check FROM recordstudent WHERE STUDENT_ID=+T_STUDENT_ID+
I have the following piece of code to check for supported intents. The code

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.