MVC RAZOR assign javascript variable to C# variable

前端 未结 2 1373
有刺的猬
有刺的猬 2021-01-21 16:25

Is it possible to assign javascript variable to c# variable in mvc razor view? e.g.


Also

相关标签:
2条回答
  • 2021-01-21 16:50

    No.

    C# runs on the server; Javascript runs on the client.
    It does not make sense to have them interact.

    You should use AJAX.

    0 讨论(0)
  • 2021-01-21 17:01

    The short and long answer is: NO.

    All these scenarios should be covered by AJAX calls to the server

    0 讨论(0)
提交回复
热议问题