I am trying to sending mail in asp.net. When admin send mail to respective email id then admin check the check boxes and send the email, after this I want to show check box disabled this is what I want because when admin again logs-in then he will not able to check again in same check boxes because mail already sent and when new email come then check box must be enable because admin still not perform any check in new email ...
In my project, when I check in check boxes and click on submit button then email send but when admin again login and then check whether new record comes or not then previous check box always enabled but I want disabled check boxes in previous record because email already send .
Like this
emalid
john_1 @gmail.com (this is new record then check box enabled)
kety_4 @yahoo.com (admin already check in this and mail send then check box must be
disabled)
Code
In my project, when I check in check boxes and click on submit button then email send but when admin again login and then check whether new record comes or not then previous check box always enabled but I want disabled check boxes in previous record because email already send .
Like this
emalid
john_1 @gmail.com (this is new record then check box enabled)
kety_4 @yahoo.com (admin already check in this and mail send then check box must be
disabled)
Code
Code:
protected void btnSendMail_Click(object sender, EventArgs e)
{
string connStr = ConfigurationManager.ConnectionStrings["email"].ConnectionString;
SqlConnection mySQLconnection = new SqlConnection(connStr);
string empId = string.Empty;
DataTable dt = new DataTable();
try
{
mySQLconnection.Open();
for (int i = 0; i < Repeateremail.Items.Count; i++)
{
CheckBox checkboc = ((CheckBox)Repeateremail.Items[i].FindControl("chkSelect"));
if (checkboc != null)
{
if (checkboc.Checked == true)
{
string emailId = ((Label)Repeateremail.Items[i].FindControl("lbl_email")).Text;
SendEmailUsingGmail(emailId);
dt.Clear();
dt.Dispose();
}
}
}
}
catch (Exception ex)
{
emailsent.Text="Failed";
}
finally
{
empId = string.Empty;
}
}
Comment