ASP.NET ListView select and highlight line through checkbox

I am trying to get an ASP.NET 3.5 ListView control to select and highlight lines through checkboxes displayed in the first column. If I use an asp:LinkButton instead of a checkbox, the line selection is supported automatically through the LinkButton's property CommandName="Select". How do I do that with the checkbox? And as soon as I managed to do that, how do I get the selected items on pressing a submit button on the form ?


I'm not sure if I'm following what you're trying to achieve, do you want a visual change when you check the checkbox? If so the best option would be using jQuery and attach to the onchange event of the checkbox.

Then when you postback the form you can itterate through the items within the ListView and locate the checkbox, check its checked state and then do what you want:

foreach(var item in listView1.Items){
  var checkbox = (CheckBox)item.FindControl("checkBox1");
  if(checkbox.Checked) // do stuff

Need Your Help

Is there a Seaside preference to create more human readable html, i.e. html including linebreaks?

smalltalk seaside

The standard html output created by Seaside is all in one line, without any linebreaks.

How to parse a string by words

java regex

I need to parse a string by highlighting all wards. At now I figured out how to split words with any symbols. But how to rewrite the code to discard words with numbers or any other characters? Here...