E
Eric via .NET 247
Hello,
I'm dynamicly filling a table with checkboxes, doing this:
...
CheckBox chkBox = new CheckBox();
chkBox.ID = "chk" + i.ToString();
chkBox.AutoPostBack=true;
...
As you can see I create Checkboxes with ID's like: chk0, chk1, chk2 etc.
When I select one (or more) checkboxes the page reloads as it should.
However, when I try to read the properties of the checkboxes:
for (int i = 0 ; i < /*number_of_items */ ; i++)
{
CheckBox c = (CheckBox)FindControl("chk"+i.ToString());
Response.Write(c.ID); // This shows "chk0, chk1, chk2 etc."
Response.Write(c.Checked); // This shows FALSE(!) every time, even when it's selected
}
Somehow he doesn't store the checked-value (true)
When the page reloads (after selecting a checkbox) the checkbox keeps selected, as it shoulds.
Can anyone help me?
Greetingz,
I'm dynamicly filling a table with checkboxes, doing this:
...
CheckBox chkBox = new CheckBox();
chkBox.ID = "chk" + i.ToString();
chkBox.AutoPostBack=true;
...
As you can see I create Checkboxes with ID's like: chk0, chk1, chk2 etc.
When I select one (or more) checkboxes the page reloads as it should.
However, when I try to read the properties of the checkboxes:
for (int i = 0 ; i < /*number_of_items */ ; i++)
{
CheckBox c = (CheckBox)FindControl("chk"+i.ToString());
Response.Write(c.ID); // This shows "chk0, chk1, chk2 etc."
Response.Write(c.Checked); // This shows FALSE(!) every time, even when it's selected
}
Somehow he doesn't store the checked-value (true)
When the page reloads (after selecting a checkbox) the checkbox keeps selected, as it shoulds.
Can anyone help me?
Greetingz,