Hi,
I'm using a dropdown list as follow:
<ejs-dropdownlist id="Address1TypeCode" placeholder="@Html.DisplayNameFor(m => m.BusinessUnit.Address1TypeCode)" popupHeight="auto"
dataSource="@Html.GetEnumSelectList<AddressTypeCode> ()" ejs-for="@Model.BusinessUnit.Address1TypeCode" floatLabelType="Auto">
<e-dropdownlist-fields text="Text" value="Value"></e-dropdownlist-fields>
</ejs-dropdownlist>
Model.BusinessUnit.Address1TypeCode has AddressTypeCode type.
The enum declaration:
public enum AddressTypeCode {
[Display(Name = "Facturar a")]
BillTo,
[Display(Name = "Enviar a")]
ShipTo,
[Display(Name = "Principal")]
Primary,
[Display(Name = "Otra")]
Other }
On load get empty value:
<select aria-hidden="true" tabindex="-1" class="e-ddl-hidden" name="BusinessUnit.Address1TypeCode" id="Address1TypeCode_hidden" data-val="true">
<option selected="" value="2">null</option>
</select>
<input id="Address1TypeCode" data-val="false" ejs-for="true" class="e-control e-dropdownlist e-lib" role="textbox" type="text" aria-labelledby="label_Address1TypeCode" readonly="" style="" aria-disabled="false" aria-label="undefined" tabindex="-1">
But datasource is correct:
new ejs.dropdowns.DropDownList({
"dataSource": ejs.data.DataUtil.parse.isJson([
{
"Disabled": false,
"Group": null,
"Selected": false,
"Text": "Facturar a",
"Value": "0"
},
{
"Disabled": false,
"Group": null,
"Selected": false,
"Text": "Enviar a",
"Value": "1"
},
{
"Disabled": false,
"Group": null,
"Selected": false,
"Text": "Principal",
"Value": "2"
},
{
"Disabled": false,
"Group": null,
"Selected": false,
"Text": "Otra",
"Value": "3"
}
]),
"fields": {
"text": "Text",
"value": "Value"
},
"floatLabelType": "Auto",
"ignoreAccent": false,
"placeholder": "Tipo",
"popupHeight": "auto",
"value": 2,
"zIndex": 1000.0
}).appendTo("#Address1TypeCode");
Could you help me? What is wrong?