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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:15:07+00:00 2026-06-15T12:15:07+00:00

I have a databound Checkboxlist in asp.NET with DataTextField and DataValueField. Now if i

  • 0

I have a databound Checkboxlist in asp.NET with DataTextField and DataValueField.

Now if i select a single item in that list, i need to have the value of only that item.

I found lots of solutions to find the values of all selected items but that is not what i need.
The only value i need is the one i justed selected or deselected.

Is there a way to get this value with jQuery code? For example in an alert like in the code below.

$("#checkboxlist").click(function () {
            alert('value of the item that just got (de)selected');
        });

Thanks alot!

UPDATE:
This is the html part:

<span id="checkboxlist">
    <input id="checkboxlist_0" type="checkbox" name="checkboxlist$checkboxlist_0" value="11" />
    <label for="checkboxlist_0">Item 1</label><br />

    <input id="checkboxlist_1" type="checkbox" name="checkboxlist$checkboxlist_1" value="12" />
    <label for="checkboxlist_1">Item 2</label><br />

    <input id="checkboxlist_2" type="checkbox" name="checkboxlist$checkboxlist_2" value="13" />
    <label for="checkboxlist_2">Item 3</label><br />

    <input id="checkboxlist_3" type="checkbox" name="checkboxlist$checkboxlist_3" value="14" />
    <label for="checkboxlist_3">Item 4</label><br />
</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-06-15T12:15:08+00:00Added an answer on June 15, 2026 at 12:15 pm

    This code should work (Attribute Ends with selector):

    $('[id$="checkboxlist"] input').click(function () {
                alert($(this).val());
    });
    

    asp:CheckBoxList will be rendered as some element (in your case it should be span) with ID like ctl00_contenttop_checkboxlist and inputs inside it. Code above will find all inputs inside element with ID that ends with checkboxlist and will be fired when one of those elements is clicked.

    But attribute ends with could be slow, so it could be better to do something like this:

    $("#<%=checkboxlist.ClientID %> input").click(function () {
                    alert($(this).val());
    });
    

    checkboxlist.ClientID will return ID of wrapper element on client side.

    UPD:

    According to your HTML, it looks like ClientID is not needed (as it looks like you are using .net 4 with ClientIDMode enabled). In that case you can simply use:

    $("#checkboxlist input").click(function () {
                    alert($(this).val());
    });
    

    Demo

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

Sidebar

Related Questions

ASP.NET and C#. I'd like to have a CheckboxList with a Select All item.
I have a checkbox list that isn't updating on the looping through it. <asp:CheckBoxList
I have a databound ListView in asp.Net. I have both ItemTemplate and SelectedItemTemplate used
I have a combobox in my WPF app that is databound to my list
I'm new to C# and ASP.NET. I have a CheckBoxList named DeploySelectList. If I
I have a checkboxlist in C# that is databound from the database. What I
I have a databound chart in ASP.NET C#. One of the databound fields is
i have a databound GridView in asp.net 2.0 with a row-selection link. When a
i have a databound treeview in asp.net. how can i expand the root node
I have a CheckBoxList and I need to get the id of each item

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.