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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:01:15+00:00 2026-05-30T05:01:15+00:00

I am using CheckBoxList control of Asp.Net. In order to get selected checkboxes i

  • 0

I am using CheckBoxList control of Asp.Net. In order to get selected checkboxes i am adding a custom attribute for Value after binding the data to the checkboxlist.

I am able to get the checked checkboxes in jQuery but i dont know how to find a particular checkbox using that custom attribute in the checkboxlist.

here is the code:

After databind in .cs file:

    foreach (ListItem li in cblRequestTypes.Items)
        li.Attributes.Add("itemValue", li.Value); 

To get the selected checboxes:

$(":checkbox").each(function() {
              if (this.checked) {

                selectedChecks += $(this).parent().attr("itemValue") + "~";

              }
            });

Now i am passing the values in the querystring and based on that i have to find the checkbox which has the itemValue attribute sent in the querystring. This part is not working or may be i am missing something here.

var id = $.QueryString["id"]
$(id.split("~")).each(function (i, item) {
                $("checkbox[itemValue=" + item +"]").attr('check',checked');

            });

This is how the HTML for CheckBoxList is rendered:

<span itemValue="3"><input id="chkBoxList_0" type="checkbox" name="chkBoxList$0" /><label for="chkBoxList_0">Text 1</label></span>
<span itemValue="5"><input id="chkBoxList_1" type="checkbox" name="chkBoxList$1" /><label for="chkBoxList_1">Text 2</label></span>
<span itemValue="6"><input id="chkBoxList_2" type="checkbox" name="chkBoxList$2" /><label for="chkBoxList_2">Text 3</label></span>
<span itemValue="7"><input id="chkBoxList_3" type="checkbox" name="chkBoxList$3" /><label for="chkBoxList_3">Text 4</label></span>
<span itemValue="8"><input id="chkBoxList_4" type="checkbox" name="chkBoxList$4" /><label for="chkBoxList_4">Text 5</label></span>
<span itemValue="9"><input id="chkBoxList_5" type="checkbox" name="chkBoxList$5" /><label for="chkBoxList_5">Text 6</label></span>
  • 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-30T05:01:17+00:00Added an answer on May 30, 2026 at 5:01 am
    ​$("span[itemValue=8] input")​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
    

    That’ll get you the checkbox in the span where itemValue (in this example) is 8.

    As I said in my comment, it’s a little confusing that you’re placing your value attribute on the span elements, and it seems to be confusing you too, since your selector is $("checkbox[itemValue=" + item +"]") – which doesn’t make much sense.

    Your selector will look for a checkbox element – which doesn’t exist; the element you’re looking for is input (with the type “checkbox”).
    And it’ll try to find one that has the dataValue attribute – which none of the checkboxes do, since that attribute is on the span.

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

Sidebar

Related Questions

I am using ASP.NET checkboxlist control. On the page I have a hyperlink. On
How to get which value items where selected from a CheckBoxList using Request.Form? I
how to set one checkbox from asp.net checkboxlist control to unchecked where the index
Greetings, how to get the selectedindex of check box from checkboxlist control using jquery?
I am creating a custom view in a SharePoint visual Web Part using ASP.NET
I'm using ASP.NET and C#. I'm programmtically creating a checkboxlist. When I check an
I modified asp.net checkboxlist using css. It hides input using display:none and I'm able
I am trying to get the selected value (or values) of the checkboxlist. My
I have asp.net checkboxlist control that bounded to a data source so the number
Greeting, if I have asp.net checkboxlist control : <asp:CheckBoxList id=list1 runat=server> <asp:ListItem>One</asp:ListItem> <asp:ListItem>Two</asp:ListItem> <asp:ListItem>Three</asp:ListItem>

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.