protected void repLabelContent_ItemCommand(object sender, RepeaterCommandEventArgs e) { B_LabelContent bll = new B_LabelContent(); if(e.CommandName=="Delete") { Label lblLabelCategoryId = e.Item.FindControl("lblLabelCategoryId") as Label; bll.Delete(lblLabelCategoryId.Text.ToString()); } if (e.CommandName == "DeleteAll") { string strLabelCategoryId = string.Empty; foreach (RepeaterItem rowview in repLabelContent.Items) { CheckBox _cb = rowview.FindControl("CheckBox1") as CheckBox; bool isChecked = _cb.Checked; Label lblid = rowview.FindControl("lblLabelCategoryId") as Label; if (isChecked) { strLabelCategoryId += lblid.Text+ ","; } } if (strLabelCategoryId.EndsWith(",")) { strLabelCategoryId = strLabelCategoryId.Substring(0, strLabelCategoryId.Length - 1); } if (strLabelCategoryId == string.Empty || strLabelCategoryId.Trim().Length == 0) { Function.ShowSysMsg(0, "<li>请选择要删除标签所对应的复选框</li><li><a href='javascript:history.back()'>返回上一页</a></li>"); } else bll.Delete(strLabelCategoryId.ToString()); } StyleBind(); }
protected void repLabelContent_ItemCommand(object sender, RepeaterCommandEventArgs e) { B_LabelContent bll = new B_LabelContent(); if (e.CommandName == "Delete") { Label lblLabelCategoryId = e.Item.FindControl("lblLabelCategoryId") as Label; bll.Delete(lblLabelCategoryId.Text.ToString()); } StyleBind(); }
protected void btnDeleteAll_Click(object sender, EventArgs e) { B_LabelContent bll = new B_LabelContent(); string strLabelCategoryId = string.Empty; foreach (RepeaterItem rowview in repLabelContent.Items) { CheckBox _cb = rowview.FindControl("CheckBox1") as CheckBox; bool isChecked = _cb.Checked; Label lblid = rowview.FindControl("lblLabelCategoryId") as Label; if (isChecked) { strLabelCategoryId += lblid.Text + ","; } } if (strLabelCategoryId.EndsWith(",")) { strLabelCategoryId = strLabelCategoryId.Substring(0, strLabelCategoryId.Length - 1); } bll.Delete(strLabelCategoryId.ToString()); StyleBind(); }