Details using Automatic View-Switching x
You now see the details page. It was automatically shown, because the url contains data620id
. Of course usually you would just go for id
or authorId
or something, but we needed a longer term, because this tutorial has so many views :). The image to the right shows where this configuration applied.
Details of Terry Pratchett
back to listSource 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 @using ToSic.Razor.Blade; @using System.Linq; <!-- unimportant stuff, hidden --> Details using Automatic View-Switching x... <!-- unimportant stuff, hidden --> @{ var urlId = CmsContext.Page.Parameters["data620id"]; int id = Int32.Parse(urlId); // find the person with this Id using LINQ var person = AsList(App.Data["Persons"]) .First(p => p.EntityId == id); } <img loading="lazy" src="@person.Mugshot?w=50&h=50&mode=crop" width="50px" style="border-radius: 50%" class="float-left"> <h3>Details of @person.FirstName @person.LastName</h3> <a href='@Link.To(parameters: "data620=page")'>back to list</a> @* Footer *@ @Html.Partial("../Shared/Layout/FooterWithSource.cshtml", new { Sys = Sys })