Modify Razor params within Javascript

Total Post:110

Points:774
 1433  View(s)
Ratings:
Rate this:

I am trying to modify parameters routeValue in Razor within Javascript. 

function setForm(param) {
   var formCariEntitas = '@Html.Action("FormCariEntitas", "Registrasi", New With {.id = "entitas"'+param+'})';
   return formCariEntitas;
}

But the error said, "param is not declared. It may be inaccessible". Is there any other way? Is it possible? Thanks

  1. Post:194

    Points:1396
    Re: Modify Razor params within Javascript

    You can do something like this

       var formCariEntitas ='@Url.Action("FormCariEntitas", "Registrasi")?parameter=' + param;

Answer