Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,155,051 members, 7,825,345 topics. Date: Sunday, 12 May 2024 at 12:05 PM

Wow! I Just Discovered U Could Do Some Looping In Ur View Without Razor - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Wow! I Just Discovered U Could Do Some Looping In Ur View Without Razor (747 Views)

Aptech Students What Languages Re Tot In Ur School / I Just Spent Entire Night Coding!! And I Discovered That..... / If U Could Have 1 App/Software/Website, What Will It Be? (2) (3) (4)

(1) (Reply)

Wow! I Just Discovered U Could Do Some Looping In Ur View Without Razor by smithsteady(m): 10:31am On Sep 12, 2013
Wow! i just discovered that u could do some looping stuff on ur view using only KnockoutJs without the Razor syntax in ASP MVC. It's so amazing.
Re: Wow! I Just Discovered U Could Do Some Looping In Ur View Without Razor by CODEEATER(m): 12:39pm On Sep 12, 2013
U having said anything bro..

Or u wnt a special HOW request b4 telling us how?
Re: Wow! I Just Discovered U Could Do Some Looping In Ur View Without Razor by smithsteady(m): 2:29pm On Sep 12, 2013
@Code-Eater is just as simple as this

KnockoutJs


<script>
function ViewModel()
{
this.donations= ko.observableArray([])
}

ko.applyBindings(new ViewModel());
</script>

HTML PART
<tbody data-bind="foreach: donations">

<td data-title="Amount Pledged">
<span data-bind="text: formatcurrency(Amount)"></span>
</td>

<td data-title="Pledge Date">
<span data-bind="text: formatdatetime(CampaignEndDate)"></span>
</td>


</tr>
</tbody>


donations is an observableArray has Amount and CampaignEndDate as properties, foreach simply iterates through your collection.
i can send you a book on KnockoutJs that will help you do MVVM, u will enjoy it pal.
However, hope u gonna go through ma code but won't appreciate it if u "EAT" it . grin

(1) (Reply)

Looking For A Membership Management Software / Need Help / Blackberry Imei Generator Script Shared

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 7
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.