I found the easiest answer I think. If you come up with a better one please let me know.
On a datalist it is a bit different than a GridView. Even on ItemCeated with checkboxes.
if you set a condition like in the first post above the checkbox will always be the default setting of the checkbox, it does not get a new setting when you check it and postback and reload. It is static and always remains the same from my experience. There where tones of info using a dataset and storing the true/false info and rebinding the datatable. Instead of doing that I found that if you do the following on the CheckedChanged property of the checkbox, you can modify any control within the same row of the datalist. I just wanted to enable disable controls insidea datalist row, noting major but this could be expanded to do other things I am sure.
- protected void chkWork_CheckedChanged(object sender, EventArgs e)
-
{
-
-
CheckBox worked = (CheckBox)sender;
-
Label lblWorkOn1 = (Label)worked.NamingContainer.FindControl("lblWorkOn");
-
DropDownList ddlspanhourstart1 = (DropDownList)
-
-
if (worked.Checked == true)
-
{
-
ddlspanhourstart1.Enabled = true;
-
}
-
else
-
{
-
ddlspanhourstart1.Enabled = false;
-
}
-
-
}
When doing it this way it seems to me that you save server and client resources depending on what you want to do. It is at least better than loading all of the datasets into vewstate or session and running through all of them again.
I got the base info here and modified it for datalist instead of Gridview The gridview info is here
http://geekswithblogs.net/azamsharp/.../10/65433.aspx
Just my 2 cents..
Ryan