We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Value not selected

Thread ID:

Created:

Updated:

Platform:

Replies:

150576 Jan 11,2020 08:59 PM UTC Jan 17,2020 05:56 AM UTC ASP.NET Core - EJ 2 3
loading
Tags: Dropdown List
Thomas Schinagl
Asked On January 11, 2020 08:59 PM UTC

I use your DropDownList like this:

        <ejs-dropdownlist id="country" placeholder="Select" dataSource="Model.BundeslaenderModelJson" value="5"></ejs-dropdownlist>

Model.BundeslaenderModelJson is the following Json:

[{"text":"Zentrale","value":"1"},{"text":"Wien","value":"2"},{"text":"Niederösterreich","value":"3"},{"text":"Oberösterreich","value":"4"},{"text":"Salzburg","value":"5"},{"text":"Tirol","value":"6"},{"text":"Vorarlberg","value":"7"},{"text":"Kärnten","value":"8"},{"text":"Steiermark","value":"9"},{"text":"Burgenland","value":"10"}]

When i load the page nothing is selected.

The value and the text field seems not bind correctly. In the Firefox debugger is see following when i look at the option of the control:


and when i click on an option it looks like this:


Two times the "text". I think there is something wrong?

  • Im Wörterbuch speichern
    • Keine Wortliste für Englisch -> Deutsch...
    • Eine neue Wortliste erstellen...
  • Kopieren

Sureshkumar P [Syncfusion]
Replied On January 13, 2020 12:36 PM UTC

Hi Thomas, 
 
Greetings from Syncfusion support. 
 
We have checked the reported requirement. We would like to let us know that when bind the object type dataSource then you need to use the fields for selecting the value property the object dataSource. Also, text property value will be set to the select element’s innerText and the select element’s text property. Kindly refer the below code,  
 
<ejs-dropdownlist id="country" placeholder="Select" dataSource="@ViewBag.data" value="@ViewBag.val"> 
    <e-dropdownlist-fields text="Vegetable" value="Id"></e-dropdownlist-fields> 
</ejs-dropdownlist> 
 
 
 
Regards, 
Sureshkumar P 


Thomas Schinagl
Replied On January 16, 2020 12:34 AM UTC

Ok thanks. I thought its enough when the datasource have a "value" and a "text" property.

Prince Oliver [Syncfusion]
Replied On January 17, 2020 05:56 AM UTC

Hi Thomas, 

Most welcome. You can refers to our documentation site, if you need any further assistance regarding this. 


We are always happy to assist you. 

Regards, 
Prince 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon