protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
dt = ADMAN.GetOuChilds(BaseOu);
Repeater1.DataSource = dt;
Repeater1.DataBind();
}
}
1 if (IsPostBack) 2 { 3 for (int i = 0; i < this.Repeater1.Items.Count; i++) 4 { 5 6 CheckBox check = (CheckBox)this.Repeater1.Items[i].FindControl("chkItems"); 7 if (check.Checked) 8 { 9 LinkButton lbtn = (LinkButton)Repeater1.Items[i].FindControl("lbtnEnable"); 10 string odeGuid = lbtn.CommandArgument; 11 DirectoryEntry ode = Adman.GetUser("LDAP://<GUID=" + odeGuid + ">"); 12 Adman.EnableUserAccount(ode); 13 } 14 } 15 }
由于上面一段代码未添加对postback的处理,导致每次checkbox的checked都是false。