protected void btnsubmitpop1_Click(object sender, EventArgs e) { if (chkdepartment.Checked) { foreach (GridViewRow gdr in grddepartment.Rows) { Label lbldepartmasterid = (Label)gdr.FindControl("lbldepartmasterid"); CheckBox chkactive123 = (CheckBox)gdr.FindControl("chkactive123"); if (chkactive123.Checked) { String strdept = "Insert Into Procedurebydefaulttbl (ProcedureMasterId,version,DepartmentId,status)values('" + ddlproceduretitle.SelectedValue + "','" + lblversion.Text + "','" + lbldepartmasterid.Text + "','" + chkactive123.Checked + "')"; SqlCommand cmddept = new SqlCommand(strdept, con); if (con.State.ToString() != "Open") { con.Open(); } cmddept.ExecuteNonQuery(); con.Close(); } ModalPopupExtenderAddnew.Hide(); chkdepartment.Checked = false; } } }
protected void chkdepartment_CheckedChanged(object sender, EventArgs e) { if (chkdepartment.Checked) { ModalPopupExtenderAddnew.Show(); } else { ModalPopupExtenderAddnew.Hide(); } }
protected void btnupdatepop1_Click(object sender, EventArgs e) { foreach (GridViewRow gdr in grddepartment.Rows) { Label lbldepartmasterid = (Label)gdr.FindControl("lbldepartmasterid"); CheckBox chkactive123 = (CheckBox)gdr.FindControl("chkactive123"); string strdept = "Select * from Policybydefaulttbl where DepartmentId='" + lbldepartmasterid.Text + "' and PolicyMasterId='" + ViewState["policymasterid"] + "' and version='" + ViewState["getversion"] + "'"; SqlCommand cmddept = new SqlCommand(strdept, con); SqlDataAdapter addept = new SqlDataAdapter(cmddept); DataSet ds = new DataSet(); addept.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { String strupdate = "Update Policybydefaulttbl set DepartmentId='" + lbldepartmasterid.Text + "',status='" + chkactive123.Checked + "' where PolicyMasterId='" + ViewState["policymasterid"] + "' and version = '" + ViewState["getversion"] + "'"; SqlCommand cmdupdate = new SqlCommand(strupdate, con); if (con.State.ToString() != "Open") { con.Open(); } cmdupdate.ExecuteNonQuery(); con.Close(); } else { String strupdate = "insert into Policybydefaulttbl (PolicyMasterId,version,DepartmentId,status) values ('" + ViewState["policymasterid"] + "','" + ViewState["getversion"] + "','" + lbldepartmasterid.Text + "','" + chkactive123.Checked + "')"; SqlCommand cmdupdate = new SqlCommand(strupdate, con); if (con.State.ToString() != "Open") { con.Open(); } cmdupdate.ExecuteNonQuery(); con.Close(); } } ModalPopupExtenderAddnew.Hide(); chkdepartment.Checked = false; btnsubmitpop1.Visible = true; btnupdatepop1.Visible = false; fillgrid(); }
protected void ImageButton3_Click(object sender, ImageClickEventArgs e) { ModalPopupExtenderAddnew.Hide(); }
protected void ImageButton3_Click(object sender, ImageClickEventArgs e) { ModalPopupExtenderAddnew.Hide(); chkdepartment.Checked = false; }