- Home
- Forum
- ASP.NET MVC - EJ 2
- Listbox mapping Text instead of Value / Id
Listbox mapping Text instead of Value / Id
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>
SIGN IN To post a reply.
4 Replies
VK
Vinoth Kumar Sundara Moorthy
Syncfusion Team
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.
Regards,
Vinoth Kumar S
VK
Vinoth Kumar Sundara Moorthy
Syncfusion Team
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.
JS file Link: https://cdn.syncfusion.com/ej2/dist/ej2.min.js
Please get back to us if you need further assistance.
Regards,
Vinoth Kumar S
JJ
Juan Jiminez
April 10, 2019 05:54 PM UTC
I confirm the patch works.
VK
Vinoth Kumar Sundara Moorthy
Syncfusion Team
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.
Regards,
Vinoth Kumar S
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
JJ Juan Jiminez
- Apr 6, 2019 05:03 PM UTC
- Apr 11, 2019 06:21 AM UTC