Vici MVC Tip #1 - foreach range

Vici Project Logo

As you all might know, or not know, I'm a hardcore user of the Vici Project. So I will try to post some tips and tricks on Vici projects here.

This piece of code helps those who would like to loop over a range of items or just use a counter to loop over.

 

 

{{foreach i in [1...20]}}
  Insert your HTML template part here
{{endfor}}

Ok, this is easy, it just loops over the numbers 1 to 20 for i. But what if I would like to do it the other way around. Just do.

{{foreach i in [20...1]}}
  Insert your HTML template part here
{{endfor}}

Tags: ,

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading


Björn Bailleul

Web application engineer and developer interested in creating customer centric applications build for ease of use and efficiency. My experience goes from intranet applications to widely used service websites, product portfolios and e-commerce websites.

Specialties

C#, MVC, AJAX, ASP.NET, SQL Server, SQL Reporting Services, WCF, XML, HTML, JavaScript, CSS, Web Services, Scrum, ...

View Bjorn Bailleul's profile on LinkedIn

Month List