If you can't use an ActionLink or AJAX and want to call a parameterised controller method from a simple/standard HTML link.
Asked
Active
Viewed 1.2k times
1
-
This is a duplicate of : http://stackoverflow.com/questions/5593759/actionlink-with-multiple-parameters – radu florescu Jan 18 '13 at 06:50
-
I didn't quite understand if this is a question or you have found some solution that are posting here. If this is a question, please make it a question. If not, StackOverflow is not the right place. – Darin Dimitrov Jan 18 '13 at 07:01
-
@Darin I wanted to post a question and answer it myself but as a new user I am unable to do that until 8 hours have elapsed. Feel free to answer it with the given code and I will edit. – GP24 Jan 18 '13 at 07:09
-
Right click on the web page .see the `source code` in the browser. – Joe.wang Jan 18 '13 at 07:13
-
As per the title: How to use a standard html link to call MVC controller method with parameters? – GP24 Jan 18 '13 at 07:15
1 Answers
4
you can send parameter with 2 method:
1.
<a href='/Controller/Method?param=paramValue&anotherParam=anotherParamValue'>link text</a>
without "/" after method and use "?" for parameter.
2.
<a href='/Controller/Method/paramValue/anotherParamValue'>link text</a>
Use "/" without "?" for each parameter and just send value. No parameter name. Be careful for parameter order
Is this what you want?

Pablo Claus
- 5,886
- 3
- 29
- 38

Saeed-rz
- 1,435
- 1
- 20
- 38
-
I wanted to help anyone with the same problem by asking a question and answering it but this will do! Thanks, will edit my question. – GP24 Jan 18 '13 at 07:51
-