Hello all,
I am using c# .net.
Thanks in advance for any help.
I have searched the web, but don't think I am using the right words, as nothing being returned is really helping.
I have a 'edit' section within my web-form which allows the user to tick (using a checklist) certain information.
For example:
• Receive newsletters • Receive phone calls etc
The checklist is populated from a database table called Requirements.
When the user ticks a certain checkbox this information should be stored within another table userRequirement.
I can display all the requirements (from Requirements) by looping through and adding another item:
foreach (tblRequirement singleRequirement in viewAllRequirement)
{
requirementCheckBoxList.Items.Add(new ListItem(singleRequirement.requirementName,singleRequirement.rrequirementID.ToString(),true));
}
However how do I then loop through the userRequirement and automatical tick the right checkboxes?
For Example:
- User selects ‘Receive Newsletters’ checkbox and presses the ‘Update’ button.
- This is then stored within the userRequirement table along with the users ID
- If the user wants to edit their details again, they can do. They are taken to the ‘edit’ page. Here the ‘Receive Newslettlers’ should already be selected.
Should I be using a if statement? If so can anyone help by providing an example?
Thanks
Clare