I`m working on a MVC project in C#, and I tried to write this in the VIEW part:
@foreach (var item in Model)
{
string str = "{ y: ";
str = str + item.count;
str = str + ", lable: ";
str = str + "\"" + item.agency_name + "\"";
str = str + "}, ";
@Html.Raw(str)
}
As you can see this is part of HTML that is in my view, and I would like to know how to omit the last comma. The problem is that I don`t know how to iterate the model item without using foreach. I also tried to define a counter, but could not manage to define a counter variable outside of this scope.