This question is a little bit tricky. There is a nested repeater in my work. I'm responsible to add asp:checkbox on every underneath repeater item, so that we can control each item by checkbox.
The markup code is:
<asp:CheckBox runat="server" ID="checkBox" AutoPostBack="true" OnCheckedChanged="CheckedChanged" />
The c# code is:
protected void CheckedChanged(object obj, EventArgs e)
{
// some works
}
I start to work on this problem and find the CheckedChanged funcion isn't fired via debugging. But, when I add a line in
if(IsPostBack){
CheckedChanged(sender, e); //add
}
It works and goes into CheckedChanged function when I debug. I have read many articles, none of them says I need to add that line in IsPostBack block. Is there anyone can show me the principle of that, thank you.
Aucun commentaire:
Enregistrer un commentaire