Skip to main content

Data Tutorials

Tutorial Home
#14 List-Details with two templates, automatic view-switching and query

List Details using Automatic View-Switching and Query

The previous examples showed you how to do auto-switch views. This example makes the code even easier, by telling the details-view to pick up the details-item from a query. You can see the query and how it's configured to the right.

Requirements
Resources

List of Persons

#14 List-Details with two templates, automatic view-switching and query

Source Code of this file

Below you'll see the source code of the file. Note that we're just showing the main part, and hiding some parts of the file which are not relevant for understanding the essentials. Click to expand the code

@inherits Custom.Hybrid.Razor14
<!-- unimportant stuff, hidden -->
List Details using Automatic View... <!-- unimportant stuff, hidden -->

  <h3>List of Persons</h3>
<ul>
  @foreach(var person in AsList(App.Data["Persons"])) {
    <li>
      <a href='@Link.To(parameters: "data621id=" + person.EntityId )'>
        @person.FirstName @person.LastName
      </a>
    </li>
  }
</ul>

<!-- unimportant stuff, hidden -->