我收到以下错误消息:
UploadId是可以为空的值错误
我假设它可能与我正在使用的数据表有关。对于控制器,我采用表单集合形式和int UploadId
:
@model System.Data.DataTable
@using System.Data;
@using (Html.BeginForm("myfunc", "Index", null, FormMethod.Post, new { enctype = "multipart/form-data"}, new { UploadId = @ViewBag.UploadId }))
{
控制器
public ActionResult myfunc(FormCollection form)
{
var theUploadId = form.UploadId;
return RedirectToAction("Send", "Mail", new { theUploadId = theUploadId });
}
答案 0 :(得分:0)
在视图中使用@ViewBag.UploadId
时,您需要在从控制器传递时使用确切的名称。
尝试在控制器方法中使用以下内容:
return RedirectToAction("Send", "Mail", new { UploadId = theUploadId });