Getting text value from CheckBoxList items

alemargo

Newcomer
Joined
Jan 2, 2004
Messages
16
Hi,

What I am trying to acheve is when user checkes several items from CheckBoxList, I want to show which items were checked. The problem raises when I try accessing items of the CheckBoxList from JavaScript. The text values are rendered as part of LABEL tag, and I cannot find any way to access LABEL tag from JavaScript. The LABEL tag does not carry any ID or NAME.

If anyone came across this, please share your findings with me.
Thanks.
 
MorningZ said:
look at doing it in the code...

there is a .SelectedItem.Text property on each checkbox item in the list

Yeah, but I cannot really use 'javascript:confirm()' with that. The whole purpose of this excersize is to ask user to confirm selection using client side script.

Thanks anyway.
 
Hummmm...
I know that a CheckListBox doesn't exist on the client side.

There's only CheckBox.
So checked them individually on the client side with a script.

N.B.: If you have a Form and that you submit... selected coupe "Name=Value" will be in the adress bar
 
Arch4ngel said:
Hummmm...
I know that a CheckListBox doesn't exist on the client side.

There's only CheckBox.
So checked them individually on the client side with a script.

N.B.: If you have a Form and that you submit... selected coupe "Name=Value" will be in the adress bar

The CheckBoxList gets rendered into table with checkboxes and their VALUES are located under LABEL tags. Anyway, I just learned from Microsoft support site, there is a known bug in DropdownList, CheckBoxList, RadiobuttonList. Basically, if you add a pair value attribute to a ListItem, it does not get rendered as to a client. Their suggestion is to create custom control, derive it from ..List and implement additional attributes functionality.
 
Damn... what a ****.
A so big solution for a so little problem ?
Should be another way of doing this...
Anyway! good luck

stay Zen !
 
alemargo said:
The CheckBoxList gets rendered into table with checkboxes and their VALUES are located under LABEL tags. Anyway, I just learned from Microsoft support site, there is a known bug in DropdownList, CheckBoxList, RadiobuttonList. Basically, if you add a pair value attribute to a ListItem, it does not get rendered as to a client. Their suggestion is to create custom control, derive it from ..List and implement additional attributes functionality.
got a link to this support page?
 
damn, i was hoping it would show some code to "Overrride" the list item stuff...

i've also run into the problem of wanting to add attributes to CheckBoxListItems, and kept hearing that rolling your own was the solution... but never ever found/seen an example of doing so....
 
Back
Top