How do I find out which CheckBoxList item has been clicked?

Last post 06-24-2009 1:32 PM by mychucky. 4 replies.

Sort Posts:

  • How do I find out which CheckBoxList item has been clicked?

    11-12-2003, 9:34 AM
    • Member
      35 point Member
    • Charles Pugh
    • Member since 07-15-2003, 11:40 AM
    • Posts 7
    How do I find out which CheckBoxList item has been clicked?

    I have a CheckBoxList on my web form with AutopostBack set to true.

    I have dynamically added a number of items to my checkboxlist, and now I want to pick up in CheckBoxList1_SelectedIndexChanged which checkbox the user has just checked or unchecked, how do I do this? Or is there better way?
  • Re: How do I find out which CheckBoxList item has been clicked?

    11-13-2003, 3:17 AM
  • Re: How do I find out which CheckBoxList item has been clicked?

    08-15-2008, 1:48 PM
    • Contributor
      3,374 point Contributor
    • mychucky
    • Member since 03-20-2006, 9:01 PM
    • Posts 2,483

    Bill2clone:
     

    This page doesn't answer the question. The poster did not asked for a CheckBoxList item that has been selected. He ask for the CheckBoxList item that has been "clicked". I have the same question too that's why I am posting to this thread.Regardless if the checkbox is checked or unchecked, I want to know the value of the item that just been clicked. Any suggestion?

  • Re: How do I find out which CheckBoxList item has been clicked?

    06-24-2009, 10:20 AM
    • Member
      2 point Member
    • kclark1515
    • Member since 03-24-2009, 3:39 PM
    • Posts 3

    I know this is an old thread, but I found this, and it really helped me find out which item has just been checked/unchecked.  Hope it helps someone else!!!

    protected void cbYears_SelectedIndexChanged(object sender, EventArgs e)
        {
            string result = Request.Form["__EVENTTARGET"];
            string [] checkedBox = result.Split('$'); ;
            int index = int.Parse(checkedBox[checkedBox.Length - 1]);

            if (cbYears.Items[index].Selected)
            {
            }
            else
            {
            }
        }

  • Re: How do I find out which CheckBoxList item has been clicked?

    06-24-2009, 1:32 PM
    • Contributor
      3,374 point Contributor
    • mychucky
    • Member since 03-20-2006, 9:01 PM
    • Posts 2,483

    kclark1515:

    I know this is an old thread, but I found this, and it really helped me find out which item has just been checked/unchecked.  Hope it helps someone else!!!

    protected void cbYears_SelectedIndexChanged(object sender, EventArgs e)
        {
            string result = Request.Form["__EVENTTARGET"];
            string [] checkedBox = result.Split('

    ); ;
            int index = int.Parse(checkedBox[checkedBox.Length - 1]);

            if (cbYears.Items[index].Selected)
            {
            }
            else
            {
            }
        }

    Thanks! I'll sure try it sometime.

Page 1 of 1 (5 items)