0
上午有有一個按鈕的網頁和表格如何通過複選框選中列表模式彈出
<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("[email protected]");
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("[email protected]", "password");
client.EnableSsl = true;
client.Send(msg);
}
return RedirectToAction("Profiles", "profile");
}
問題
我的問題是無法將複選框選中的值傳遞給彈出窗口的get actionresult。這是基於複選框檢查項目發送電子郵件給多個成員。
任何人都可以幫助我......請
是的,我已經將其存儲在一個隱藏字段,並試圖通過它.. – user1677467
公衆的ActionResult的SendMail(字符串myhidden),但其採取的空...沒有值被傳遞 – user1677467
中有你,你包裹在表表單? – CoffeeCode