Question: How to call a non action method by clicking a button in MVC

```
@using (Html.BeginForm("GenerateError", "Home", FormMethod.Post, new { id = "submitForm" }))
{
     <button type="submit" id="btnSubmit" name="Command" value="Submit">Generate Error</button> 
}

```

Now, what if GenerateError is an non action method. How can we call [NonAction] methods using button click

Answer: 
You can make an action wrapper for `GenerateError` and use it

EDITED:

```
@using (Html.BeginForm("GenerateErrorWrapper", "Home", FormMethod.Post, new { id = "submitForm" }))
{
     <button type="submit" id="btnSubmit" name="Command" value="Submit">Generate Error</button> 
}

```

Your NonActionMethod:

```
[NonActionMethod]
public void NonActionMethod()
{
    ...
}

```

Your action wrapper:

```
public ActionResult View()
{
    NonActionMethod();
}

```

I just can't understand why do you need it
You can also use Jquery `$.post` or `$.ajax` to check the status or any thing else.