How to assign JavaScript value in Razor?

2

I have a Razor @minhaVarRazor variable and would like to change its value based on a value obtained from another variable, but that is JavaScript .

function setValue(minhaVarJavaScript){
  @minhaVarRazor = minhaVarJavaScript;
}

Does anyone have any ideas?

    
asked by anonymous 22.07.2015 / 22:29

1 answer

2

This can not be done. The razor markings are translated into HTML values on the server itself, and the response the client receives from the network (from the HTTP request) has no razor marking, only pure HTML / JS / CSS markup. As JavaScript runs on the client (by the browser), and the browser does not "know" razor (including variable streets), then what you want to do is not possible.

    
22.07.2015 / 23:49