Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

razor list to js array

<script>
    var myArray = [];

    @foreach (var d in Model.data)
    {
      	// Using the @: operator
      	//we can use javascript variables in razor C#
        @:myArray.push("@d");
    }
</script>
 
PREVIOUS NEXT
Tagged: #razor #list #js #array
ADD COMMENT
Topic
Name
7+5 =