Hi all,
I have a checkboxlist control on a webpage and I populate it based on a list of present on the database. Each user has a preference which is stored in the database. When the user want to edit these set of preferences I have to display the intial chosen ones.
Link is what I found, my code is
for(int i = 0; i < myDS.Tables["TrailInterest"].Rows.Count; i++)
{
if(Int32.Parse(myDS.Tables["TrailInterest"].Rows[i]["TrailID"].ToString()) == TrailId)
{
strTemp = myDS.Tables["TrailInterest"].Rows[i]["InterestType"].ToString().Trim();
ListItem li = cblInterests.Items.FindByText(myDS.Tables["TrailInterest"].Rows[i]["InterestType"].ToString().Trim());
if(li != null)
{
li.Selected = true;
}
}
}
But the checkboxes aren't checked. What am I doing wrong?
Thanks
Pria