Once CheckBox select then checkbox disabled in asp.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prita1001
    New Member
    • Nov 2013
    • 5

    #1

    Once CheckBox select then checkbox disabled in asp.net

    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
    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;
      }
    }
    Last edited by Frinavale; Nov 13 '13, 03:09 PM. Reason: Added code tags and formatted code so that it is easier to read.
  • prita1001
    New Member
    • Nov 2013
    • 5

    #2
    anybody can tell me please about this problem

    Comment

    • psurvi
      New Member
      • Nov 2013
      • 6

      #3
      You can try giving checkboc.Checke d = false after SendEmailUsingG mail(emailId);

      Comment

      Working...