2021年3月21日星期日

the name does not exist in the current context model

I'm creating the web using MVC structure. Besides, I had jquery to support on it. I have an issue make me stress whole day.

$(document).ready(function () {   $("#addmore").click(function () {              var i ; //get current step showing (+1) due to lenght start from 0              for (i = $(".table .header").length + 1; i < @Model.StepCount; i++) {                      var rows = "<tr class='header'> "                      + "<td class='prtoducttd'>" + @Model.TimeStamp[i] +  "</td>"                        + "</tr>";                  $('#myTable tbody').append(rows);              }          });  

it returns the error the name does not exist in the current context with i at TimeStamp. I don't know why. my TimeStamp is an array. If I put @Model.StepCount instead then the code run without error. but that is not what I want.

Please help me on this. If I can not pass the i value to model.TimeStamp then is there any other way to do that?

https://stackoverflow.com/questions/66733832/the-name-does-not-exist-in-the-current-context-model March 21, 2021 at 10:56PM

没有评论:

发表评论