DiscoDude
DiscoDude

Reputation: 617

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 done like this.

Upvotes: 1

Views: 1462

Answers (2)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039120

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
}

Upvotes: 2

archil
archil

Reputation: 39501

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

Upvotes: 0

Related Questions