Trouble finding where a Controller Action is being called

I have worked on MVC3 before. But am having a hard time finding where a given controller action is being called.

We use Ajax and I wonnder if that may be the reason it's hard for me to find.

I search for "MyActionName(" but it doees not show up.

Any suggestions?

Thanks.
newbiewebSr. Software EngineerAsked:
Who is Participating?
 
P1ST0LPETECommented:
Lets say we have a "HomeController", and inside this controller we have an "Index(int id)" method.

If I wanted to hit the Index method on the Home controller with AJAX, lets say using jQuery, I could have something like this:

$.ajax
({
        type: 'POST',
        url: '/Home/Index/' + id,
        success: function(data)
        {
               // do something with data
        }
});


or you could have just a link:

<a href="/Home/Index/123">Click Me</a>


or you could have mvc html helpers creating links for you such as:

@Html.Action("Index", "Home")
or
@Html.ActionLink("Click Me", "Index", "Home")


or you might have a View with a form on it like this:

@using (Html.BeginForm("Index", "Home", new { @id = 123 }))
{
      @* form elements here *@
}

and any <input type="submit"> elements on the above form that get clicked would hit that method


or you may check your global.asax file to see how the routing is working.  You may have a default route that is spilling into your method.
0
 
newbiewebSr. Software EngineerAuthor Commented:
THANKS! Great Answer!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.