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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Listbox mapping Text instead of Value / Id

Thread ID:





143828 Apr 6,2019 05:03 PM UTC Apr 11,2019 06:21 AM UTC ASP.NET MVC - EJ 2 4
Tags: ListBox
Juan Jiminez
Asked On April 6, 2019 05:03 PM UTC

I'm trying to use the new ListBox control to map a simple select list like this:

Dictionary<string, object> htmlAttr = new Dictionary<string, object>();
htmlAttr.Add("name", "IDs");

List<SelectListItem> list = new List<SelectListItem>();
list.Add(new SelectListItem { Value = "1", Text = "Admin" });
list.Add(new SelectListItem { Value = "2", Text = "Technician" });

@Html.EJS().ListBox("lbList").DataSource(list).Fields(new ListBoxFieldSettings { Value = "Value", Text = "Text" }).SelectionSettings(new ListBoxSelectionSettings { ShowCheckbox = true, Mode = SelectionMode.Multiple }).Value("1,2".Split(',')).HtmlAttributes(htmlAttr).Render()

I do it the same way with MultiSelect and it maps the value on submit correctly, however, when using ListBox, it doesn't map the Value property of my list but the Text property instead. I can confirm it when looking at the html source:

<select class="e-hidden-select" multiple="" name="IDs"><option selected="" value="Admin"></option><option selected="" value="Technician"></option></select>

Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On April 8, 2019 12:58 PM UTC

Hi Juan, 
Thank you using Syncfusion products. 
We have checked your reported issue “Listbox mapping Text instead of Value / Id” and we are able to reproduce it in our end. And we confirmed the reported issue is a defect and logged the defect report for the same. We have planned to include the fix for this issue in our upcoming EJ2 patch release. We appreciate your patience until then.  
You can track the status of defect using below link from our feedback portal. 
Vinoth Kumar S 

Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On April 10, 2019 05:27 PM UTC

Hi Juan, 
Thank you for your patience. 
We are glad to announce that our Essential JavaScript 2 patch release (v17.1.40) has been rolled out successfully and in that release, we have added the fix for “Listbox mapping Text instead of Value / Id” in our updated online nuget packages. So you can update the nuget packages and use the updated JS file to resolve this issue in your end. Please find the links below. 
Please get back to us if you need further assistance.    
Vinoth Kumar S 

Juan Jiminez
Replied On April 10, 2019 05:54 PM UTC

I confirm the patch works.

Thanks Vinoth!

Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On April 11, 2019 06:21 AM UTC

Hi Juan, 
You are most welcome. Please feel free to contact us if you need any further assistance on Syncfusion components. 
Vinoth Kumar S 


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