Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This creates an instance of your model:</p> <pre><code>DetailsModel myDetailsModel = new DetailsModel(); </code></pre> <p>But what does that instance consist of? For starters, the three properties inside of that model are all of reference types, so they're all going to default to <code>null</code> anyway. Thus, within the view, <code>model.MyANIME</code> is <code>null</code>. You can fix <em>that</em> small part by always initializing the properties (for example, in the default constructor):</p> <pre><code>public partial class DetailsModel { public ANIME MyANIME { get; set; } public CHARACTER MyCHARACTER { get; set; } public ACTORS MyACTORS { get; set; } public DetailsModel() { MyANIME = new ANIME(); MyCHARACTER = new CHARACTER(); MyACTORS = new ACTORS(); } } </code></pre> <p>But this doesn't actually populate them with meaningful data either. If <code>TITLE_OR</code> is a <code>string</code>, for example, then even in this case <code>model.MyANIME.TITLE_OR</code> is still going to be <code>null</code> (or, at best, an empty string).</p> <p>Whatever data you want to show on that page, you need to <em>get</em> that data from somewhere and populate the model with that data. Then it will be available on the page. For example, if you do this in your controller then you'll see the example value on the page:</p> <pre><code>DetailsModel myDetailsModel = new DetailsModel(); myDetailsModel.MyANIME = new ANIME(); myDetailsModel.MyANIME.TITLE_OR = "sample title"; return View(myDetailsModel); </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