using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; public partial class Bulkmail_DeleteTemplatesProspects : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { if (Session["Bulkmail"] == null) { Response.Redirect("BulkmailLogin.aspx"); } ModCommon.Fill_Combo("Select Template_KId, Template_Name from BEM_Template", ddlTemplate); ModCommon.Fill_Combo("Select Category_KId, Category_Name from BEM_Category", ddlCategory); btnDelTemplate.Attributes.Add("onclick", "return Del();"); btnDelProspects.Attributes.Add("onclick", "return Del();"); //CheckBox ckh; //ckh = (CheckBox)GridView1.HeaderRow.FindControl("CheckBox2"); // ckh.Attributes.Add("onclick", "test(this)"); lbllbl.Visible = false; } lblMsg.Visible = false; //if (GridView1.Rows.Count > 0) //{ // lblCount.Visible = true; // lbllbl.Visible = true; //} //else //{ // lbllbl.Visible = false; // lblCount.Visible = false; //} } protected void btnDelTemplate_Click(object sender, EventArgs e) { ModCommon.ExecuteQuery("Delete From BEM_Template where Template_KId='" + ddlTemplate.SelectedItem.Value +"'"); ModCommon.showmessage("Template Deleted Successfully.", lblMsg); File.Delete(Server.MapPath("Upload") +"\\"+ ddlTemplate.SelectedItem.Text); ModCommon.Fill_Combo("Select Template_KId, Template_Name from BEM_Template", ddlTemplate); } protected void btnDelProspects_Click(object sender, EventArgs e) { if (GridView1.Rows.Count > 0) { int Count=0; for (int i = 0; i < GridView1.Rows.Count; i++) { if (((CheckBox)GridView1.Rows[i].FindControl("CheckBox1")).Checked == true) { // string test =(st-ring) GridView1.DataKeys[i].Value; ModCommon.ExecuteQuery("Delete from BEM_Prospect_Detail where prospect_KID='" + GridView1.DataKeys[i].Value.ToString() + "'"); Count++; } } if (Count == 0) { ModCommon.showmessage("Select Records For Delete.", lblMsg); } else { ModCommon.showmessage(Count + " Prospects Deleted Successfully.", lblMsg); } fillgrid(); ((CheckBox)GridView1.HeaderRow.FindControl("CheckBox2")).Attributes.Add("onclick", "FindControl(this)"); if (GridView1.Rows.Count > 0) { for (int i = 0; i < GridView1.Rows.Count; i++) { ((CheckBox)GridView1.Rows[i].FindControl("CheckBox1")).Attributes.Add("onclick", "FindControl1(this," + i + ")"); } } } else { ModCommon.showmessage("No Any Records For Delete.", lblMsg); } } protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e) { try { if (ddlCategory.SelectedIndex > 0) { lblCount.Visible = true; lbllbl.Visible = true; lblCount.Text = "0"; fillgrid(); ((CheckBox)GridView1.HeaderRow.FindControl("CheckBox2")).Attributes.Add("onclick", "FindControl(this)"); if(GridView1.Rows.Count>0) { for(int i=0;i