KnockoutJS and ASP.NET Repeater
The foreach binding in Knockout is a powerful and handy binding and can be used to create tables. But sometimes you're stuck with old-school ASP.NET Repeaters to create your tables (and a lot is done server-side). The good news is you can still use Knockout, just not the foreach binding.
In fact, it's quite simple. Just use the following syntax in the ItemTemplate of your Repeater:
<tr data-bind="with: myItems()[<%# Container.ItemIndex %>]"></tr>
You can find a full explanation on my blog and a working example on GitHub.
Written by Peter Morlion
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Knockout
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#