1
Answer

How to call controller methods from view in MVC 3

Sreenath G

Sreenath G

13y
8k
1
 

Hi,

How can I call a controller method from a view on button click. I have been trying like below, but was no use.

<input type="button" value="Go Somewhere Else" onclick="location.href='<%: Url.Action('MyMethod', 'ControllerName', new { id = item.ID })'" />

 

Any help here please.

Thanks


Answers (1)