MailMessage mailmsg = new MailMessage();
mailmsg.From = new MailAddress("your gmail ID");
mailmsg.To.Add(new MailAddress("tomailaddress"));
mailmsg.Subject = sub ;
StringBuilder body = new StringBuilder();
body.AppendLine( Subject );
mailmsg.Body = body.ToString();
mailmsg.IsBodyHtml = true;
SmtpClient Sc = new SmtpClient();
Sc.EnableSsl = true;
Sc.Credentials = new System.Net.NetworkCredential(Your gmail id, "PWD");
try
{
Sc.Send(mailmsg);
Mess = "Mail Send Successgully.";
}
catch (Exception ex)
{
Mess = ex.Message.ToString() ;
}
}
}
Thursday, January 1, 2009
Retrive Specific cell text from the Grid view By checking Check box
1 .Add the Grid View Control to form from the Tool BOx.
2. Add Data Source to the Grid View
3.Then Right Click on the Grid View Control ,select the Edit Template.
4.Add the CHeck box control to the Edit Panel
5.Finally click on the End edit Template.
6.Now Add the Button Control to the Form.
7.Go to Code Behind Page Write the Below Code Smaple in the On button click event.
string id = "";
foreach (GridViewRow gr in GridView1.Rows)
{
CheckBox chk = (CheckBox)gr.FindControl("CheckBox2");
chk.Checked = true;
if (chk.Checked == true)
{
id =id + ","+gr.Cells[1].Text ;
}
txtbxemail.Text = id.ToString();
}
2. Add Data Source to the Grid View
3.Then Right Click on the Grid View Control ,select the Edit Template.
4.Add the CHeck box control to the Edit Panel
5.Finally click on the End edit Template.
6.Now Add the Button Control to the Form.
7.Go to Code Behind Page Write the Below Code Smaple in the On button click event.
string id = "";
foreach (GridViewRow gr in GridView1.Rows)
{
CheckBox chk = (CheckBox)gr.FindControl("CheckBox2");
chk.Checked = true;
if (chk.Checked == true)
{
id =id + ","+gr.Cells[1].Text ;
}
txtbxemail.Text = id.ToString();
}
Subscribe to:
Comments (Atom)