M
Mariano Drago
Hi there
Im having problems with some checkbox generated at runtime.
In a form, i draw some html checkboxes, each chekbox represents a kinda
"department" the user is linked to. The problems is that when a postback is
generated and the page reloads, the old state (checked) of the checkboxes
remains although i explicit set it to false.
To ilustrate the problem, simply create a form, drag a panel (or
placeholder, its the same) and a button and put this code in page_load
event:
for(int i = 0; i < 10; i++)
{
HtmlInputCheckBox chk = new HtmlInputCheckBox();
chk.ID = "chk_" + i.ToString();
chk.Name = chk.ID;
chk.Checked = false;
Panel1.Controls.Add(chk);
}
No matter if you set "enabledviewstate" to false in the Panel or the in the
page, you will see that after hiting the button the checks will be as you
left they before.
I check with FindControl inside the controlcollection of the panel and its
empty...
How can i avoid that???? How can i set the checkbox to false in every hit?
Thanks in advance.-
Im having problems with some checkbox generated at runtime.
In a form, i draw some html checkboxes, each chekbox represents a kinda
"department" the user is linked to. The problems is that when a postback is
generated and the page reloads, the old state (checked) of the checkboxes
remains although i explicit set it to false.
To ilustrate the problem, simply create a form, drag a panel (or
placeholder, its the same) and a button and put this code in page_load
event:
for(int i = 0; i < 10; i++)
{
HtmlInputCheckBox chk = new HtmlInputCheckBox();
chk.ID = "chk_" + i.ToString();
chk.Name = chk.ID;
chk.Checked = false;
Panel1.Controls.Add(chk);
}
No matter if you set "enabledviewstate" to false in the Panel or the in the
page, you will see that after hiting the button the checks will be as you
left they before.
I check with FindControl inside the controlcollection of the panel and its
empty...
How can i avoid that???? How can i set the checkbox to false in every hit?
Thanks in advance.-