retain checked state of checkbox

  • Thread starter Thread starter voodoman
  • Start date Start date
V

voodoman

hi there

can't work out for the life of me at the mo why the code below doesn't
do what I want. the last matching PK it finds sets the checkbox and
this is the only 1 that displays. any ideas please.

int contractCounter = 0;

foreach(Timesheets.Contract oContract in allContracts)
{
foreach(Timesheets.Contract aContract in contractsOfDelegate)
{
CheckBox selectedContract =
(CheckBox)contractListManageDelegate.Items[contractCounter].FindControl("sel");
selectedContract.Checked = false;

if(oContract.PK == aContract.PK)
{
//Check the box
selectedContract.Checked = true;

}
}
contractCounter++;
 
Back
Top