我有一个带有按钮和表格的页面
<input type="submit" value="Email" name="button" class="openDialog" data-dialog-id="Mail Dialog" data-dialog-title="Send Mail" data-url="<%: Url.Action("SendMail") %>" />
<form>
<table>
<tr>
<th>
<input type="checkbox"/>
<input type="hidden" class="textfield" id="video0_tags" name="video0_tags" />
</th>
<th>
FirstName
</th>
<th>
LastName
</th>
</tr>
<% foreach (var item in Model)
{ %>
<tr>
<td>
<div class="taglist">
<input type="checkbox" name="check" value="<%: item.ProfileId %>" />
</div>
</td>
<td>
<%: Html.DisplayFor(modelItem => item.FirstName)%>
</td>
<td>
<%: Html.DisplayFor(modelItem => item.LastName)%>
</td>
<% } %>
</table>
</form>
在我的控制器中
[HttpGet]
public ActionResult SendMail(string video0_tags)
{
return View();
}
[HttpPost]
public ActionResult SendMail(int[] check,Profile profile, mail email)
{
foreach (var item in check)
{
var dbprofile = db.Profile.Single(p => p.ProfileId == item);
string Emailid = dbprofile.EmailId;
MailMessage msg = new MailMessage();
MailAddress fromAddress = new MailAddress("xxxx@gmail.com");
msg.From = fromAddress;
msg.To.Add(Emailid);
msg.Subject = email.Subject;
msg.Body = email.Body;
msg.Priority = MailPriority.High;
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = new NetworkCredential("xxxxx@gmail.com", "password");
client.EnableSsl = true;
client.Send(msg);
}
return RedirectToAction("Profiles", "profile");
}
问题
我的问题是我无法将复选框选中的值传递给弹出窗口的 get actionresult。这是根据复选框选中的项目向多个成员发送电子邮件。
任何人都可以帮助我.....请