Note that there are some explanatory texts on larger screens.

plurals
  1. POData not showing in the strongly typed view
    text
    copied!<p>I have an issue with my controller. Data from my table is not showing in my strongly typed view. but when I <code>return View(CanaClie0012.toList())</code>; I can see my data perfectly. Im not getting any error. can someone tell me what im doing wrong.</p> <p><strong>My Table Model:</strong></p> <pre><code>public partial class CanaClie0012 { public string Client00130012 { get; set; } public string F1Pais00200012 { get; set; } public string F1Cana02530012 { get; set; } public string Direcc0012 { get; set; } public Nullable&lt;System.DateTime&gt; TmStmp0012 { get; set; } } public partial class Clientes0013 { public string Client0013 { get; set; } public string Nombre0013 { get; set; } public string F1Pais00200013 { get; set; } } </code></pre> <p><strong>My Custom Model to combine the two table is:</strong></p> <pre><code>public class ClientModel { public CanaClie0012 CanaClie0012 { get; set; } public Clientes0013 Clientes0013 { get; set; } } </code></pre> <p><strong>My Controller:</strong></p> <pre><code>public ViewResult Index() { List&lt;ClientModel&gt; lm = new List&lt;ClientModel&gt;(); ClientModel vm = new ClientModel(); lm.Add(vm); return View(lm); } </code></pre> <p><strong>My View:</strong></p> <pre><code>@model IEnumerable&lt;ContactManager.Models.ClientModel&gt; @{ ViewBag.Title = "Index"; } &lt;h2&gt;Index&lt;/h2&gt; &lt;p&gt; @Html.ActionLink("Create New", "Create") &lt;/p&gt; &lt;table&gt; &lt;tr&gt; &lt;th&gt; Client00130012 &lt;/th&gt; &lt;th&gt; F1Pais00200012 &lt;/th&gt; &lt;th&gt; F1Cana02530012 &lt;/th&gt; &lt;th&gt; Direcc0012 &lt;/th&gt; &lt;th&gt; TmStmp0012 &lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;/tr&gt; @foreach (var item in Model) { &lt;tr&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.CanaClie0012.Client00130012) &lt;/td&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.CanaClie0012.F1Pais00200012) &lt;/td&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.CanaClie0012.F1Cana02530012) &lt;/td&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.CanaClie0012.Direcc0012) &lt;/td&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.CanaClie0012.TmStmp0012) &lt;/td&gt; &lt;td&gt; @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) | @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) | @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ }) &lt;/td&gt; &lt;/tr&gt; } &lt;/table&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload