Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
public ActionResult Index()
       {
           return View(new IncidentModel());
       }

       [HttpPost]
       public ActionResult Index(String Uid)
       {
           string u_Id = Uid;
           return View(new IncidentModel().Incidents(u_Id));


       }

this is how i done action overloading
Posted

1 solution

To avoid the conflict when Action Methods are having same name then you should use ActionName attribute.
Visit:
http://stackoverflow.com/questions/436866/can-you-overload-controller-methods-in-asp-net-mvc[^]
Try this:
[HttpPost][ActionName("IndexPost")] 
      public ActionResult Index(String Uid)
       {
           string u_Id = Uid;
           return View(new IncidentModel().Incidents(u_Id));
 

       }
 
Share this answer
 
Comments
NithyaGopu 28-Mar-14 3:19am    
after specifying action name am getting blank page
Snesh Prajapati 28-Mar-14 3:27am    
For testing purpose remove the [ActionName("IndexPost")] and change the action method name then check appropriate action is calling or not.
NithyaGopu 28-Mar-14 4:56am    
now am getting null reference exception..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900