Skip to main content

Declare Action

In This Article

Declares an MVC action for a string argument passed to the ActionLink, RenderAction or Action methods, referencing an undeclared action.

#Availability

From the context menus or via shortcuts:

  • when the edit cursor or caret is on an appropriate string argument passed to the ActionLink, RenderAction or Action methods.

Note

If the controller referenced from the same method call is not declared, Declare Action is not available. Use the Declare Controller code provider instead.

#Example

<%: Html.ActionLink("Test", "TestAction", "Test")%>

Result:

//The following code is added to the TestController class:

public ActionResult MyAction()
{
    return View();
}
'The following code is added to the TestController class:

Public Function MyAction() As ActionResult
    Return View()
End Function