the checkbox event is not triggerd?
i have created checkbox event maually.
chkCheckBox1.CheckedChanged += new EventHandler(chkCheckBox1_CheckedChanged);
this event is not triggered,in pageload i have put
(!page.ispostback)
{
}
so when i clik the check box it goes to the page load and not going to the evnt
protected void chkCheckBox1_CheckedChan开发者_开发问答ged(object sender, EventArgs e)
{
..........
}
the checkbox event is not triggerd..
Have you enabled AutoPostBack property on your control?
By default this is set to False when you add a checkbox control to your page. Try setting it to true.
Set the Autopostback
property to true.
chkCheckBox1.CheckedChanged += new EventHandler(chkCheckBox1_CheckedChanged);
You have to wire up this event on every call to the page so if you have put this inside of the if(!Page.IsPostBack)
then put it outside.
Take a look at this article Adding a dynamic control to a placeholder control and wire up the event. It shows an extra step for making things totally dynamic but the principles stay the same for what you're after.
Grz, Kris.
To trigger the following event
protected void chkCheckBox1_CheckedChanged(object sender, EventArgs e)
{
..........
}
Set the checkbox autopostback property to TRUE
精彩评论