protected void grdModtype_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); switch (e.CommandName) { case "Edit": loadfilter(); Insert = false; Id = strCA; List <Data.Modtype> listE = ModtypeBUS.Modtype_GetById(Id); txtModtype_Name.Text = listE[0].Modtype_Name; txtModtype_Code.Text = listE[0].Modtype_Code; chkStatus.Checked = listE[0].Modtype_Status == "1" || listE[0].Modtype_Status == "True"; txtModtype_Targer.Text = listE[0].Modtype_Target; ddlFilter.SelectedValue = listE[0].Modtype_Filter; pnView.Visible = false; pnUpdate.Visible = true; break; case "Delete": ModtypeBUS.Modtype_Delete(strCA); BindGrid(); break; } }
protected void DeleteButton_Click(object sender, EventArgs e) { DataGridItem item = default(DataGridItem); for (int i = 0; i < grdModtype.Items.Count; i++) { item = grdModtype.Items[i]; if (item.ItemType == ListItemType.AlternatingItem | item.ItemType == ListItemType.Item) { if (((CheckBox)item.FindControl("ChkSelect")).Checked) { string strId = item.Cells[1].Text; ModtypeBUS.Modtype_Delete(strId); } } } grdModtype.CurrentPageIndex = 0; BindGrid(); }