Can you overload controller methods in ASP.NET MVC?

前端 未结 17 1667
无人共我
无人共我 2020-11-22 08:10

I\'m curious to see if you can overload controller methods in ASP.NET MVC. Whenever I try, I get the error below. The two methods accept different arguments. Is this some

17条回答
  •  既然无缘
    2020-11-22 08:51

    I have faced same issue in my application too. Without Modifiyig any Method information, I have provided [ActionName("SomeMeaningfulName")] on Action head. issue resolved

    [ActionName("_EmployeeDetailsByModel")]
            public PartialViewResult _EmployeeDetails(Employee model)
            {
                // Some Operation                
                    return PartialView(model);
                }
            }
    
    [ActionName("_EmployeeDetailsByModelWithPagination")]
            public PartialViewResult _EmployeeDetails(Employee model,int Page,int PageSize)
            {
    
                    // Some Operation
                    return PartialView(model);
    
            }
    

提交回复
热议问题