asp.net - Produce different html view in each cycle -


please this.

how can produce different html view in each cycle. can mvc can not asp.net web form. can repeater( or listview ) , multiview?

thanks everything.

<div id="movieresults">     @foreach (var movie in homecontroller.movies)     {         if(condition)         {             block of html1         }         else if(condition)         {             block of html2         }         else if(condition)         {             block of html3         }      } </div> 

you can use usercontrol

ucontrol.ascx

<%@ control language="c#" classname="ucontrol" %> <div>control content</div> 

ucontrolview.aspx

<%@ page language="c#" autoeventwireup="true"%> <%@ register tagprefix="uc" tagname="mycustomcontrol" src="~/controls/ucontrol.ascx" %> <html> <body> <form runat="server">     <uc:mycustomcontrol id="mypartialview" runat="server" /> </form> </body> 

you can refer https://msdn.microsoft.com/en-us/library/fb3w5b53(v=vs.100).aspx


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -