public void btnUpda_Click(object sender, EventArgs e) { int chkcount = 0; string Empis = ""; string EmpisUpdates = ""; int k = 0, l = 0; foreach (GridViewRow row in GridUserUpdateList.Rows) { CheckBox chk = row.Cells[0].FindControl("chk_Check") as CheckBox; if (chk.Checked == true) { chkcount = chkcount + 1; } } if (chkcount >= 1) { foreach (GridViewRow row in GridUserUpdateList.Rows) { CheckBox chk = row.Cells[0].FindControl("chk_Check") as CheckBox; if (chk != null && chk.Checked) { LinkButton lblSalesEmpid = row.Cells[0].FindControl("lblSalesEmpid") as LinkButton; DropDownList lblSalesRoleId = row.Cells[0].FindControl("ddlsalesroles") as DropDownList; string roleid = lblSalesRoleId.Text; if (roleid != "0") { DataSet InsertEmployee = objHotLeadBL.InsertProcessRights(lblSalesEmpid.Text, Convert.ToInt32(lblSalesRoleId.Text), Convert.ToInt32(ddlcenters.SelectedValue), Session[Constants.USER_NAME].ToString()); EmpisUpdates = lblSalesEmpid.Text + ","; k = k + 1; } else { Empis = lblSalesEmpid.Text + ","; l = l + 1; } } } try { if (Empis.EndsWith(",")) { Empis = Empis.Remove(Empis.Length - 1, 1); } if (EmpisUpdates.EndsWith(",")) { EmpisUpdates = EmpisUpdates.Remove(EmpisUpdates.Length - 1, 1); } } catch { } if (k != 0 && l != 0) { string Text = "Selected " + Empis + " added successfully and \\n " + EmpisUpdates + " not added select roles and update. "; System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('" + Text + "');", true); } else if (k != 0 && l == 0) { System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('Selected employee(s) added successfully.');", true); MpUserUpdatelist.Hide(); } else if (k == 0 && l != 0) { System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('please select role of the employee and update.');", true); MpUserUpdatelist.Show(); } } else { System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('Please select employees and update.');", true); MpUserUpdatelist.Show(); } GetLeadsSattus(); }