Can I do something like this?

Posted by kumar on Stack Overflow See other posts from Stack Overflow or by kumar
Published on 2010-05-20T16:53:40Z Indexed on 2010/05/20 17:00 UTC
Read the original article Hit count: 207

Filed under:
|
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<StudentInfo>>" %>

<% int i = 0; %>

<% foreach(var e in Model){%>
<div>
<% if(i==0) { %>
  <% Html.RenderAction("student", "home", new { @et = e}); %>
<% break;
   } %>
    <div>
    <span>
     <% Html.RenderAction("studentDetails", "home", new { @et = e }); %>
        </span>
    </div>
</div>
<%i++; } %>

here my intension was to execute Renderction Student only once.. and Studentdetails should be multiple times..

but int value is allways taking i =0 bec each time page is loading its considering 0 allways..

can anybody tell me how to do this?

thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc