#region 全选
protected void cbAll_CheckedChanged(object sender, EventArgs e)
{
foreach (RepeaterItem item in rptList.Items)
{
CheckBox cb = item.FindControl("cbItems") as CheckBox;
cb.Checked = cbAll.Checked;
}
}
#endregion
#region 删除
protected void btnDel_Click(object sender, EventArgs e)
{
string ids = "";
foreach (RepeaterItem item in rptList.Items)
{
CheckBox cb = item.FindControl("cbItems") as CheckBox;
if (cb.Checked)
{
ids = ids + cb.ToolTip + ",";
}
}
ids = ids.TrimEnd(',');
if (string.IsNullOrWhiteSpace(ids))
{
HtmlCommon.ShowMsg("请选择您要删除的数据");
return;
}
else
{
string[] strArry = ids.Split(',');
BLL.QuestionBLL Bll = new BLL.QuestionBLL();
int result = Bll.DeleteByIDs(strArry);
if (result > 0)
{
HtmlCommon.ShowMsg("删除成功!", "dept.aspx");
}
else
{
HtmlCommon.ShowMsg("删除失败!");
}
}
}
#endregion
protected void cbAll_CheckedChanged(object sender, EventArgs e)
{
foreach (RepeaterItem item in rptList.Items)
{
CheckBox cb = item.FindControl("cbItems") as CheckBox;
cb.Checked = cbAll.Checked;
}
}
#endregion
#region 删除
protected void btnDel_Click(object sender, EventArgs e)
{
string ids = "";
foreach (RepeaterItem item in rptList.Items)
{
CheckBox cb = item.FindControl("cbItems") as CheckBox;
if (cb.Checked)
{
ids = ids + cb.ToolTip + ",";
}
}
ids = ids.TrimEnd(',');
if (string.IsNullOrWhiteSpace(ids))
{
HtmlCommon.ShowMsg("请选择您要删除的数据");
return;
}
else
{
string[] strArry = ids.Split(',');
BLL.QuestionBLL Bll = new BLL.QuestionBLL();
int result = Bll.DeleteByIDs(strArry);
if (result > 0)
{
HtmlCommon.ShowMsg("删除成功!", "dept.aspx");
}
else
{
HtmlCommon.ShowMsg("删除失败!");
}
}
}
#endregion