emit client script in check box list

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

h

How do i get an asp checkBoxList to emit client script. I want it so that when each checkbox is clicked, i can cause some action to happen

i tried

CheckBoxList cbl = new CheckBoxList()
for(int i = 0; i < 5; i++

ListItem li = new ListItem(i.ToString(), i.ToString())
li.Attributes.Add("onclick", string.Format("alert('{0}')", i.ToString()))
cbl.Items.Add(li)


but no onclick attribute is emitted to the page
Am i doing it wrong, or is there a way around this

Ada
 
The checkbox list translates to a table where every checkbox is an <input
.... type="checkbox ...>. The inputs have id made out of the checkbox list id
with suffix _0, _1 etc. You can make a client script that will locate the
<input...> elements and set them up for the actions you need.

Eliyahu

hi

How do i get an asp checkBoxList to emit client script. I want it so that
when each checkbox is clicked, i can cause some action to happen.
 
Back
Top