开发者

ASP.NET MVC3 - receiving the "No overload for method 'BeginForm' takes 6 arguments" error message

My controller has two following methods...

public FileResult GetImage(int id)
    {
     // something
    }
    public FileResult GetImageTwo(int id)
    {
     // something   
    }

Create.cshtml as the following code...

@using (Html.BeginForm("Create", "ProductCategory", "GetImage", 
 "GetImageTwo",  FormMethod.Post, new { enctype = "multipart/form-data" 
}))

Update

So the answer is it can't be开发者_如何学JAVA done like this.


You need to specify which controller action you are going to post to and use the proper overload:

                         action      controller            method                htmlAttributes
                            ↓             ↓                   ↓                        ↓
@using (Html.BeginForm("GetImage", "ProductCategory", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    //somecode
}


That has nothing to do with routes. Error is simple, you are calling Html.BeginForm overload that does not exists. In other words, there's no method like Html.BeginForm which would take 6 arguments. If you update your question to show what are you trying to achieve, maybe stack could help you

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜