Note that there are some explanatory texts on larger screens.

plurals
  1. POTick correct checkbox if 'checked' within the database
    text
    copied!<p>I am using c# .net.</p> <p>Thanks in advance for any help.</p> <p>I have searched the web, but don't think I am using the right words, as nothing being returned is really helping.</p> <p>I have a 'edit' section within my web-form which allows the user to tick (using a checklist) certain information. </p> <p>For example:</p> <p>• Receive newsletters • Receive phone calls etc</p> <p>The checklist is populated from a database table called Requirements. </p> <p>When the user ticks a certain checkbox this information should be stored within another table userRequirement.</p> <p>I can display all the requirements (from Requirements) by looping through and adding another item: </p> <pre><code> foreach (tblRequirement singleRequirement in viewAllRequirement) { requirementCheckBoxList.Items.Add(new ListItem(singleRequirement.requirementName,singleRequirement.rrequirementID.ToString(),true)); } </code></pre> <p>However how do I then loop through the userRequirement and automatical tick the right checkboxes?</p> <p>For Example:</p> <ul> <li>User selects ‘Receive Newsletters’ checkbox and presses the ‘Update’ button. </li> <li>This is then stored within the userRequirement table along with the users ID </li> <li>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.</li> </ul> <p>Should I be using a if statement? If so can anyone help by providing an example?</p> <p>Thanks</p> <p>Clare</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload