<script type="text/javascript">
window.onload = function () {
for (var i=0;i<@Model.listsinfo.Count;i++)
{
$('#work').append($('<div class="col-md-3" id="temp"><label for="text1">'+ '@Model.listsinfo[i].Label' +'</label></div><div class="col-md-3"> <input type="text" placeholder="Alerts" class="form-control" id="text1"> </div>'));
}
}
</script>
In the above code, I am passing a list from my controller and trying to iterate it. But @Model.listsinfo[i].Label is not working and the error says 'i' does not exist in the current context. I am able to access the list value by giving index values @Model.listsinfo[0].Label but iterations are not working. Any help is appreciated.