1.

Can I Use Razor Code In Javascript In Asp.net Mvc?

Answer»

Yes. We can USE the razor code in javascript in cshtml by using <text> element.

< script type="text/javascript">

@FOREACH (var ITEM in Model) {

< text >

//javascript goes here which USES the server VALUES

< text >

}

< script>

Yes. We can use the razor code in javascript in cshtml by using <text> element.

< script type="text/javascript">

@foreach (var item in Model) {

< text >

//javascript goes here which uses the server values

< text >

}

< script>



Discussion

No Comment Found