Skip to Content
Introducing .NET 4.0: with Visual Studio 2010
book

Introducing .NET 4.0: with Visual Studio 2010

by Alex Mackey
February 2010
Beginner content levelBeginner
400 pages
11h 13m
English
Apress
Content preview from Introducing .NET 4.0: with Visual Studio 2010

11.6. DataView Binding

DataView binding can be carried out declaratively, programmatically, or via a mixture of the two. Let's look at declarative binding first.

11.6.1. Declarative Binding

In the first example, you will create an array of people consisting of a person's name and age and then bind it declaratively:

  1. Add the following script block in the header of your page:

    <script type="text/javascript">
    Sys.require(Sys.components.dataView);
    
    var people = [
       { Name: "Alex Mackey", Age: "28" },
       { Name: "Sharyn Mackey", Age: "35" },
       { Name: "Brett Chaney", Age: "33" },
       { Name: "Jenny Chia", Age: "24"}];
     </script>
  2. Now replace the <body> tag with the following HTML:

    <body xmlns:dataview="javascript:Sys.UI.DataView"> <div id="peopleView" class="sys-template" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ASP.NET 3.5 For Dummies®

ASP.NET 3.5 For Dummies®

Ken Cox
ASP.NET 4 Unleashed

ASP.NET 4 Unleashed

Stephen Walther, Kevin Hoffman, Nate Dudek

Publisher Resources

ISBN: 9781430224556Purchase book