Hi,
Badis wrote:
Hi,
I have a 5 checkboxes and I would like to be able to use them as grouped
radiobuttons or a checkboxlist (one selection at the time) in the client side
without having to use a autopostback.
I think the only way is javascript but I don't know how. does any one have a
sample code to do that?
Cheers
I would recommend against that, because checkboxes are not destined to
behave like radiobuttons, it's confusing the user and is bad ergonomy.
That said, you can programatically check or uncheck a checkbox in
JavaScript using this code:
// The checkbox's ID is myCheckbox1
var cb = document.getElementById( "myCheckbox1" );
if ( cb != null
&& cb.checked != null )
{
cb.checked = true; // or false
}
HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog:
http://www.galasoft-LB.ch
PhotoAlbum:
http://www.galasoft-LB.ch/pictures
Support children in Calcutta:
http://www.calcutta-espoir.ch