Note that there are some explanatory texts on larger screens.

plurals
  1. POselecting checkbox from checkbox list on condition
    text
    copied!<p>i have 5 checkboxlists, and each of the checkboxlists have the same 6 checkboxes. i have to check these checkboxlists during <code>page_Load</code> under certain conditions. How do i do that.?</p> <pre><code>for (int j = 0; j &lt; no_of_listitem; j++) { SqlCommand check = new SqlCommand("SELECT ISGoal1, ISGoal2,ISGoal3, ISGoal4,ISGoal5 FROM PRM2011_EMPLOYEE_GOAL WHERE EmployeeID = '" + employeeid[j] + "'", con); SqlDataReader y = check.ExecuteReader(); while (y.Read()) { if (null != y &amp;&amp; y.HasRows) { string yes_or_no = y["ISGoal1"].ToString(); yes_or_no = yes_or_no.Trim(); if (yes_or_no == "Yes") { CheckBoxList1.Items[j].Selected = true; } //else CheckBoxList1.Items[j].Selected = false; yes_or_no = y["ISGoal2"].ToString(); yes_or_no = yes_or_no.Trim(); if (yes_or_no == "Yes") { CheckBoxList2.Items[j].Selected = true; } //else CheckBoxList2.Items[j].Selected = false; yes_or_no = y["ISGoal3"].ToString(); yes_or_no = yes_or_no.Trim(); if (yes_or_no == "Yes") { CheckBoxList3.Items[j].Selected = true; } //else CheckBoxList3.Items[j].Selected = false; yes_or_no = y["ISGoal4"].ToString(); yes_or_no = yes_or_no.Trim(); if (yes_or_no == "Yes") { CheckBoxList4.Items[j].Selected = true; } //else CheckBoxList4.Items[j].Selected = false; yes_or_no = y["ISGoal5"].ToString(); yes_or_no = yes_or_no.Trim(); if (yes_or_no == "Yes") { CheckBoxList5.Items[j].Selected = true; } //else CheckBoxList5.Items[j].Selected = false; } } y.Close(); } </code></pre> <p><code>employeeid[]</code> contains id of 6 employees.no_of_listitems is 6 which is the list of thses 6 employee ids.</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