I am iterating through a string of characters and finding a checkbox. I find the checkbox without any problems and if the character of the iteration is equal to 't', I set the Checked property of the checkbox to true.
However, for whatever reason, although it does check the appropriate checkboxes, executing this code also means that when I click any checkbox myself, nothing happens. Also, the submit button on my page no longer does anything if I execute this code. I'm puzzled as to what may be the reason for this.
The buttons are created programmatically on init and are located inside an update panel.
DateTime date = new DateTime(2015, 11, 18);
foreach (char c in attendee.accommodation)
{
ID = "accommodationCheckBox" + date.ToShortDateString();
CheckBox checkbox = (CheckBox)FindControl(ID);
if (checkbox != null && c == 't')
{
checkbox.Checked = true;
}
date = date.AddDays(1);
}
Aucun commentaire:
Enregistrer un commentaire