CheckBoxList Individual Item Detection

Discussion in 'ASP .Net' started by =?Utf-8?B?UnlhbiBTY3VsbHk=?=, Jun 23, 2004.

  1. Hello I have problem with determining exactly what CheckBoxList element is selected using JavaScript code. When I databind to the checkboxlist it renders it on the page and instead of giving each checkbox a value, it gives it a name and does a <label> tag for the Text of the item, and has nothing about the value anywhere in the rendered code for the checkboxlist. So when I enumerate through the controls on the page in javascript, I can never access the value of the checkboxlist item so I don't know which one is selected. It seems to work with radiolists though, cause when asp.net names them it sets the value to the value you've databinded it, but it doesn't seem to do it with the checkboxlist. Anybody know why?
    Thank You
    Ryan
     
    =?Utf-8?B?UnlhbiBTY3VsbHk=?=, Jun 23, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?UnlhbiBTY3VsbHk=?=

    avnrao Guest

    Check for the item in the javascript before you set visible to true or
    false.
    if(document.all('youritemname'))
    {
    iterate;
    }

    hth,
    Av.
    "Ryan Scully" <> wrote in message
    news:...
    > Hello I have problem with determining exactly what CheckBoxList element is
    > selected using JavaScript code. When I databind to the checkboxlist it
    > renders it on the page and instead of giving each checkbox a value, it
    > gives it a name and does a <label> tag for the Text of the item, and has
    > nothing about the value anywhere in the rendered code for the
    > checkboxlist. So when I enumerate through the controls on the page in
    > javascript, I can never access the value of the checkboxlist item so I
    > don't know which one is selected. It seems to work with radiolists
    > though, cause when asp.net names them it sets the value to the value
    > you've databinded it, but it doesn't seem to do it with the checkboxlist.
    > Anybody know why?
    > Thank You
    > Ryan
     
    avnrao, Jun 23, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Robishaw
    Replies:
    1
    Views:
    4,348
    Victor Garcia Aprea [MVP]
    Dec 27, 2003
  2. Patrick.O.Ige
    Replies:
    5
    Views:
    19,122
    Patrick.O.Ige
    Jun 19, 2005
  3. Nathan Sokalski
    Replies:
    2
    Views:
    456
    Nanda Lella[MSFT]
    Apr 23, 2009
  4. TS
    Replies:
    5
    Views:
    721
    Jeffrey Tan[MSFT]
    Aug 10, 2005
  5. Nathan Sokalski

    ClientIds for individual CheckBoxes in a CheckBoxList

    Nathan Sokalski, Apr 3, 2009, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    909
    Nanda Lella[MSFT]
    Apr 29, 2009
Loading...

Share This Page