Note that there are some explanatory texts on larger screens.

plurals
  1. POIEnumerable in my ViewModel is not displayed with EditorForModel
    primarykey
    data
    text
    <h1>ViewModel</h1> <pre><code>[Validator(typeof(ProdutoCategoriaValidator))] public class ProdutoCategoriaViewModel { [HiddenInput(DisplayValue = false)] public Guid ID { get; set; } public IEnumerable&lt;SelectListItem&gt; Tipos { get; set; } // &lt;&lt;&lt;&lt;------- Is not showing in my view [AdditionalMetadata("data-bind", "event: { change: function(data) { Link(data.Nome()); }}")] public string Nome { get; set; } [DataType(DataType.Url)] [AdditionalMetadata("Prefixo", "Produtos/{tipo-de-produto}#")] public string Link { get; set; } public int? Ordem { get; set; } public ProdutoCategoriaViewModel() { ID = Guid.NewGuid(); } } </code></pre> <h1>Solution</h1> <p><img src="https://i.stack.imgur.com/4rBlG.png" alt="Solution explorer"></p> <h1>View (_Formulario.cshtml)</h1> <pre><code>@model ProdutoCategoriaViewModel @using (Html.BeginForm(null, null, FormMethod.Post, new { id="form-produtocategoria", data_bind = "submit: salvar" })) { @Html.AntiForgeryToken() &lt;legend&gt;@Html.MvcSiteMap().SiteMapTitle()&lt;/legend&gt; &lt;fieldset&gt; @Html.ValidationSummary(false, "Verifique os erros abaixo:") @Html.EditorForModel() &lt;/fieldset&gt; &lt;div class="buttons"&gt; @Html.ActionLink("Cancelar", "Index") &lt;input type="submit" value="SALVAR" /&gt; &lt;/div&gt; } </code></pre> <h1>SelectListItem.cshtml</h1> <pre><code>@model IEnumerable&lt;SelectListItem&gt; @Html.DropDownListFor(m =&gt; m, Model) &lt;p&gt;Test&lt;/p&gt; </code></pre> <h1>Result</h1> <p>Full image: <a href="https://i.imgur.com/I7HxA.png" rel="nofollow noreferrer">http://i.imgur.com/I7HxA.png</a></p> <p><img src="https://i.stack.imgur.com/2yzcR.png" alt="View result"></p> <h1>Notes</h1> <ul> <li>I've tried to put the attribute "UIHint" but still nothing is displayed!</li> </ul> <h1>Questions</h1> <p>What am I doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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