Html.NopDropDownListFor not generating anything

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hello,

I´m working on a plugin an trying to use Html.NopDropDownListFor in a .cshtml view file.
In other cases, the Html.NopDropDownListFor function works.
My function call looks like this: Html.NopDropDownListFor(model => model.CatalogPropertyMappings[catalogPropertyMappingIndex].PropertyId, currentCategoryCategoryPropertiesSelectList);

currentCategoryCategoryPropertiesSelectList is a IList<SelectListItem> List.
model.CatalogPropertyMappings[catalogPropertyMappingIndex].PropertyId is an integer Value in my Model.

If I debug the NopDropDownListFor function the value of result in the row return MvcHtmlString.Create(result.ToString()); is {<select class="form-control" data-val="true" data-val-number="The field PropertyId must be a number." id="CatalogPropertyMappings_0__PropertyId" name="CatalogPropertyMappings[0].PropertyId"><option selected="selected" value="1">Wasserart</option>
<option value="1002">Barcode</option>
<option value="1003">Lateinischer Name</option>
<option value="1004">Gruppenverhalten</option>
<option value="1005">Aquariengr&#246;sse</option>
<option value="1006">Gr&#246;sse</option>
<option value="1007">Anspruchsvoll</option>
<option value="1008">Temperatur</option>
<option value="1009">Schwimmposition</option>
</select>}


Can anyone help me out with this?
The function doesn´t print any HTML markup.
6 years ago
Sounds like maybe you are just missing the @using Nop.Web.Models.Common directive in your plugin view?

The @Html.DropDownList helper should work too:

@Html.DropDownList("CatalogProperties", Model.CatalogPropertyMappings.AvailableCategoryPropertyOptions, new { onchange = "setLocation(this.value);" })
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.