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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:35:46+00:00 2026-05-30T10:35:46+00:00

I have a listview with multiple columns. One of the columns is a checkbox,

  • 0

I have a listview with multiple columns. One of the columns is a checkbox, another is a label. There are other columns but they’re not really relevant to this issue. In the click event of a button on this page I want to read the value of the label if the checkbox adjacent to it is selected. How do I read the label contents?

The code I have so far is included below. The code runs but the checked status of the checkboxes is never found to be checked. I checked the itemTemplate to confirm the name and ensure this problem wasn’t the result of a typo.

        CheckBox chkSelected;
        List<int> selectedIds = new List<int>();


        foreach (var x in lvPeople.Items)
        {
            chkSelected = (CheckBox)x.FindControl("IsAlumni");

            if (chkSelected.Checked)
            {
                int id = (int)lvPeople.DataKeys[x.DisplayIndex].Value;                    

                selectedIds.Add(id);
            }
        }
  • 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-30T10:35:47+00:00Added an answer on May 30, 2026 at 10:35 am

    You’d have something like this:

    foreach (var x in lvPeople.Items)
    {
        chkSelected = (CheckBox)x.FindControl("IsAlumni");
    
        if (chkSelected.Checked)
        {
            int id = (int)lvPeople.DataKeys[x.DisplayIndex].Value;
    
            var myLabel = (Label)x.FindControl("lblContactId");
            var myLabelContent = myLabel.Text;                  
    
            selectedIds.Add(id);
        }
    }
    

    For example, in the selected item event you could have this code:

    CheckBox chkSelected =
               lvPeople.Items(lvPeople.SelectedIndex).FindControl("IsAlumni") as CheckBox;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview ...with multiple columns. If I click on one column, it
In one of my Activities, I have multiple ListView controls. Say List 1 ,
I have a ListView (GridView) with multiple columns and so far I can sort
I have an Android ListView with rows that include one checkbox, and four text
I have a ListView with multiple choice entries where some are checked from the
A have a ListView that is rendered with multiple items. Now I want to
I have seen examples of ListView where each row has multiple view objects, like
I have been following the following post on using multiple ItemTemplates in a ListView
I have ListView that uses a GridView to display several columns of data. Two
I have a listview that has multiple entries and each entry has 2 subitems.

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.