I want to create a checkbox that when clicked, selects/deselects all items
in a list box, on the client side (no round trip)
What kind of code should I add (and where in the asp.net web control) ?
First of all EVERYBODY that is SERIOUS about JavaScript should deeply
consider prototype.js
(Google for it)
Now assuming you have prototype.js file included in your page:
var x = $('idOfMyCheckBox'); // often in "RenderContent" of your
WebControl "string.Format("$('{0}');", ClientID)
Element.observe(x, 'click', function(){
$A(myListBoxElement.childNodes).each(function(idx){
idx.selected = true;
});
});
And off you go!

To do this WITHOUT prototype.js would mean you're writing 10-20 times
as many lines of code if you are serious about being browser
compatible...
..t