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.Data.SqlClient; using System.Text; using System.Drawing; using System.Reflection; public partial class Bulkmail_SendTextMail : System.Web.UI.Page { static int NoOfMail; protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { ModCommon.Fill_Combo("Select Category_KId, Category_Name from BEM_Category", ddlCategory); NoOfMail = 0; txtSenderMobileNo.Attributes.Add("onkeypress", "return numbersonly(event);"); Popolateddl(); fillsize(); ddlColour.Attributes.Add("onchange", "ChangeColour(this);"); rblBold.Attributes.Add("onclick", "ChangeBold(this);"); ddlSize.Attributes.Add("onchange", "ChangeSize(this);"); rblItalic.Attributes.Add("onclick", "ChangeItalic(this);"); } } protected void fillsize() { int count; count=7; ddlSize.Items.Add("Select"); for (int i = 0; i < 10; i++) { ddlSize.Items.Add(count.ToString()); count = count + 2; } } public void Popolateddl() { System.Drawing.Color cl = new System.Drawing.Color(); Type t = cl.GetType(); ddlColour.Items.Add("Select"); foreach (PropertyInfo pi in t.GetProperties()) { ColorConverter d = new ColorConverter(); try { ListItem li = new ListItem(pi.Name); Color cll = Color.FromName(pi.Name); li.Attributes.Add("style", String.Format("background-color: {0}", cll.Name)); ddlColour.Items.Add(li); } catch { } } } protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e) { try { NoOfMail = count(); } catch { } } public int count() { try { SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select Count(Email) from BEM_Prospect_Detail where Categoryid ='" + ddlCategory.SelectedItem.Value + "'"; cmd.CommandType = CommandType.Text; cmd.Connection = con; if (con.State == ConnectionState.Open) { con.Close(); } else { con.Open(); } return (int)cmd.ExecuteScalar(); } catch { return 0; } } //protected void ddlColour_SelectedIndexChanged(object sender, EventArgs e) //{ // if (ddlColour.SelectedItem.Text != "Select") // { // Color c = Color.FromName(ddlColour.SelectedItem.Text); // txtMsgBody.ForeColor = c; // } //} }