private void bindata() { MyRoleBLL roleBLL = new MyRoleBLL(); Repeater1.DataSource = roleBLL.list(); Repeater1.DataBind(); }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.Equals("delete")) { HiddenField hi = e.Item.FindControl("HiddenField1") as HiddenField; MyRoleBLL roleBLL = new MyRoleBLL(); if (roleBLL.Delete(int.Parse(hi.Value)) == 1) { ClientScript.RegisterStartupScript(GetType(), "", " <script>alert('删除成功!')</script>"); } else { return; } } bindata(); }