How to pass a value to razor variable from javascript variable, is it possible asp.net mvc razor view engine?
@{
int a = 0;
}
I see that this problem was discussed some time ago, but if anyone 'll meet with this again, here is my solution:
In your *.cshtml View file:
JavaScript variable model is something that I need to pass to Razor ViewModel. It can be done with ajax request. You just need to have proper argument/s in your action, that matches Json object created in JavaScript.
Hope it'll help someone!