Pass multiple parameters in Html.BeginForm MVC4 controller action

前端 未结 4 1729
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 15:26

I have something like this:

   public ActionResult ImageReplace(int imgid,HttpPostedFileBase file)
    {
        string keyword = imgid.ToString();
        .         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 15:47

    Use this overload, which allows you to distinguish between route values and HTML attribtues:

    @using (Html.BeginForm(
            "ImageReplace", "Member", 
            new { imgid = @Model.Id }, 
            FormMethod.Post,
            new { enctype = "multipart/form-data" }))
    { 
         
        
    }
    

提交回复
热议问题