【发布时间】:2014-01-06 04:21:35
【问题描述】:
我有这样的事情:
public ActionResult ImageReplace(int imgid,HttpPostedFileBase file)
{
string keyword = imgid.ToString();
.......
}
在我的 .cshtml 中:
@model Models.MemberData
@using (Html.BeginForm("ImageReplace", "Member", FormMethod.Post,
new { imgid = @Model.Id, enctype = "multipart/form-data" }))
{
<input type="file" name="file" id="file" value="Choose Photo" />
<input type="submit" name="submit" value="Submit" />
}
这里 imgid 的值没有传递给控制器动作。显示错误,参数字典包含方法“System.Web.Mvc.ActionResult ImageReplace”的不可为空类型“System.Int32”的参数“imgid”的空条目
【问题讨论】:
标签: c# asp.net-mvc asp.net-mvc-4