我的反馈表中有复选框,看起来
我在模型中添加了复选框
namespace CorePartners_Site2.Models
{
public class CareerForm
{
//...
public List<CheckBoxes> EmploymentType { get; set; }
}
public class CheckBoxes
{
public string Text { get; set; }
public bool Checked { get; set; }
}
}
添加到我的控制器
[HttpGet]
public ActionResult CareerForm()
{
CareerForm model = new CareerForm();
model.EmploymentType = new List<CheckBoxes>
{
new CheckBoxes { Text = "Fulltime" },
new CheckBoxes { Text = "Partly" },
new CheckBoxes { Text = "Contract" }
};
return View(model);
}
但后来我需要将选定的复选框添加到电子邮件中,但我不知道该怎么做。
我试过了
public ActionResult CareerForm(CareerForm Model, HttpPostedFileBase Resume)
{
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.BodyEncoding = Encoding.UTF8;
string message = //...
"Type: " + Model.EmploymentType;
msg.Body = message;
//....
}
但我收到的电子邮件只是文本类型:System.Collections.Generic.List`1[CheckBoxes]
如何使其正常工作?