N
nabil m
hi i have 5 checkboxes i would like to when the user click on 1 or multiple
checkbox i would like to email 1 or multiple files attachments to them
ex: mailMsg.Attachments.Add(myAttachment+i);
but getting error: Specified cast is not valid.
thank you in advance
my code below:
MailAttachment myAttachment0 = new MailAttachment
(this.Server.MapPath("../serverForms/Auto_Form_01.pdf"),
MailEncoding.Base64);
MailAttachment myAttachment1 = new MailAttachment
(this.Server.MapPath("../serverForms/Homeowners_Form_01.pdf",
MailEncoding.Base64);
MailAttachment myAttachment3 = new MailAttachment
(this.Server.MapPath("../serverForms/Condo_Coop_Form_01.pdf",
MailEncoding.Base64);
MailAttachment myAttachment4 = new MailAttachment
(this.Server.MapPath("../serverForms/Renters_Form_01.pdf",
MailEncoding.Base64);
for (int i=0;i<this.CheckBoxListForms.Items.Count;i++)
{
if (this.CheckBoxListForms.Items.Selected)
{
// would like to attach the appropriate checkbox file in my checkbox
list
// GETTING ERROR - Exception Details: System.InvalidCastException:
Specified cast is not valid.
mailMsg.Attachments.Add(myAttachment+i);
}
}
checkbox i would like to email 1 or multiple files attachments to them
ex: mailMsg.Attachments.Add(myAttachment+i);
but getting error: Specified cast is not valid.
thank you in advance
my code below:
MailAttachment myAttachment0 = new MailAttachment
(this.Server.MapPath("../serverForms/Auto_Form_01.pdf"),
MailEncoding.Base64);
MailAttachment myAttachment1 = new MailAttachment
(this.Server.MapPath("../serverForms/Homeowners_Form_01.pdf",
MailEncoding.Base64);
MailAttachment myAttachment3 = new MailAttachment
(this.Server.MapPath("../serverForms/Condo_Coop_Form_01.pdf",
MailEncoding.Base64);
MailAttachment myAttachment4 = new MailAttachment
(this.Server.MapPath("../serverForms/Renters_Form_01.pdf",
MailEncoding.Base64);
for (int i=0;i<this.CheckBoxListForms.Items.Count;i++)
{
if (this.CheckBoxListForms.Items.Selected)
{
// would like to attach the appropriate checkbox file in my checkbox
list
// GETTING ERROR - Exception Details: System.InvalidCastException:
Specified cast is not valid.
mailMsg.Attachments.Add(myAttachment+i);
}
}