Kendo Version - Kendo MVC 2019.2.619
My values appear in the previous option item.
Drop Down List name and values:
I have one item and a "Select from" option (see data above) in my list
I select "ABCHERG" from my drop down list and the value that's returned is blank.
If I select the "Select From" option the value returned is "ABCHERG"
Patrick,
I am glad setting the OptionLabel resolved the issue.
The behavior you are experiencing is not related to the original subject of this bug report item. It appears to be related to Grid configuration, rather than a bug in the DropDownList helper.
We would advise opening a support ticket with product Grid for ASP.NET MVC or opening a thread in the Grid's forums, where you can get assistance with configuring the Grid's popup editor.
Regards,
Ivan Danchev
Progress Telerik
Ivan,
The changes to the OptionLabel is what made this all work
However I’m now having problems with the DropDown within a Popup Editor.
In the Popup editor I have several dropdowns. Each dropdown would normally have the selected values visible but in the new version of Kendo the values are not visible but if I click on the dropdown my selected values are all highlighted. If I then click on another field within the popup the dropdown selected value is now visible.
Here is my dropdown code:
@(Html.Kendo().DropDownListFor(m => m)
.Name("SoType")
.DataTextField("Text")
.DataValueField("Value")
.AutoBind(false)
.Events(e => e.Change("onPrioritySelect"))
.BindTo(new List<SelectListItem>()
{
new SelectListItem()
{
Text = "SO",
Value = "SO"
},
new SelectListItem()
{
Text = "HMS",
Value = "HMS"
}
})
)
@(Html.Kendo().DropDownListFor(m => m)
.Name("PreTerms")
.DataTextField("Name")
.DataValueField("ID")
.AutoBind(false)
.Events(e => e.Change("onPreOrderTermsSelect"))
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetTerms", "Home");
})
.ServerFiltering(true);
})
)
@(Html.Kendo().DropDownListFor(m => m)
.Name("PreCarrier")
.DataTextField("Name")
.DataValueField("ID")
.AutoBind(false)
.Events(e => e.Change("onPreOrderCarrierSelect"))
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCarrier", "Home");
})
.ServerFiltering(true);
})
)
Here is my Grid Code:
@(Html.Kendo().Grid(Model.OrderLines)
.Name("OrderGrid")
.Columns(columns =>
{
columns.Bound(p => p.PlanId).Width("5%").Title("Plan Id");
columns.Bound(p => p.PO).Title("Customer PO").Width("13%");
columns.Bound(p => p.PartNumber).Title("Part").Width("13%");
columns.Bound(p => p.Quantity).Title("Qty").Width("10 %").Format("{0:n0}");
columns.Bound(p => p.Price).Format("{0:c4}").Width("10%").Title("Price");
columns.Bound(p => p.SoType).Width("5%").Title("Priority");
columns.Bound(p => p.SO_Status).Width("10%").Title("Status");
columns.Bound(p => p.Order_No).Width("10%").Title("Order #");
columns.Bound(p => p.Id).Width("9%").Title("Id #");
columns.Bound(p => p.chkClear).Width("5%").Filterable(false).Title("");
columns.Command(command => { command.Edit().Text(" "); }).Title("").Width("5%");
columns.Bound(p => p.PickNote).Hidden(true);
columns.Bound(p => p.PackNote).Hidden(true);
columns.Bound(p => p.FreightCarrier).Hidden(true);
columns.Bound(p => p.Term).Hidden(true);
columns.Bound(p => p.Date).Hidden(true);
})
.AutoBind(false)
.Sortable()
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row)
)
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.Id))
.Events(events => { events.Error("error_handler").RequestEnd("availQty"); })
.Read(read => read.Action("GetOrders", "Home").Data("onOrderGridLoad"))
.Update(update => update.Action("Update_PreOrder", "Report"))
)
.Editable(editable => editable.Mode(GridEditMode.PopUp).Window(w => w.Title("Pre-Order Editor")))
.Events(e => e.DataBound("orderGridDatabound").Cancel("onCancelPreOrder").Edit("onEditPreOrder"))
)
Attached are two images of how the popup window look like when opened and then when I clicked on the Priority dropdown without making a selection.
Thanks
Patrick Sturge
.Events(ev => ev.Change(
"onChange"
))
<script>
function
onChange(e) {
alert(e.sender.value());
}
</script>