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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:16:07+00:00 2026-05-26T16:16:07+00:00

I am doing a data bind to a check box, So I display 6

  • 0

I am doing a data bind to a check box, So I display 6 values in my check box, and users are given 2 random values when they are created. How can I check the values in the check box after I do the databind. If value 2 and 4 are give for a user then the check box should display 1 to 6 which I am doing using databind and I have to check 2 and 4 value how can I do that

 while (reader.Read())
        {
            rolegiven.Add(reader["RoleName"].ToString());
        }
        reader.Close();
        if (rolegiven.Any(item => item.Equals("Value1")))
        {
            ckl_EditRole.SelectedIndex = 0;
        }else{}
        if (rolegiven.Any(item => item.Equals("Value2")))
        {
            ckl_EditRole.SelectedIndex = 1;
        }else{}
        if (rolegiven.Any(item => item.Equals("Value3")))
        {
            ckl_EditRole.SelectedIndex = 2;
        }else{}

If value 2 and 3 are selected( from Databinding I find that value2 and value 3 are given for the user) only value 3 is checked. How can I do this

  • 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-26T16:16:08+00:00Added an answer on May 26, 2026 at 4:16 pm

    You have to use Items collection of CheckBoxList control.

    List<string> rolegiven = new List<string>()
        {
             "A","B","C","D","E","F"
        };
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CheckBoxList1.DataSource = rolegiven;
                CheckBoxList1.DataBind();
    
                CheckBoxList1.Items[0].Selected = true;
                CheckBoxList1.Items[2].Selected = true;
                CheckBoxList1.Items[4].Selected = true;
    
                //or
    
                if(rolegiven.Any(item => item.Equals("A")))
                  CheckBoxList1.Items[0].Selected = true;
                if(rolegiven.Any(item => item.Equals("D")))
                  CheckBoxList1.Items[3].Selected = true;
                ...
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing: data = env.InstallAs('$PREFIX/share/odysi', 'data') env.Alias('install', data) Which works fine the first time.
I'm doing some data analysis in Matlab, and anytime I call the hold function
When doing an INSERT with a lot of data, ie: INSERT INTO table (mediumtext_field)
We're doing a complex bit of data accumulation. Our customer sends us some stuff
I'm doing an assignment for my Data Structures class. we were asked to to
When you are doing integration tests with either just your data access layer or
I've been doing some Web-Projects lately that rely on heavy Data-Binding and have been
I am doing some research about how to access data in a UniData database
I am doing a project in which I require btree or b+tree data structure.
hi im doing a loop so i could get dict of data, but since

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.