I am looking for a proper syntax. I am using MVC and in my view I need to loop through the model since I need to do some other things at different counts. I am a novice here and looked through tons of postings but didn't find the syntax. Here is the code, which works:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MvcMysurvey.Models.Mysurvey>>" %>
<% foreach (var item in Model) {%>
<%: Html.HiddenFor(m => item.ID) %>
And here is the code I need the syntax for to make it working:
<% for (int i = 0; i < Model.Count(); i++) {%>
<%: Html.HiddenFor(m => m[i].ID) %>