Declined
Last Updated: 06 Sep 2019 13:57 by ADMIN
Patrick
Created on: 02 Aug 2019 18:50
Category: DropDownList
Type: Bug Report
0
Dropdownlist Values on Previous option

Kendo Version - Kendo MVC 2019.2.619

 

My values appear in the previous option item.

Drop Down List name and values:

  • Name = "Select From" 
  • ID = ""
  • Name = "ABCHERG"
  • ID = "ABCHERG"

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"

3 comments
ADMIN
Ivan Danchev
Posted on: 06 Sep 2019 13:57

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

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Patrick
Posted on: 05 Sep 2019 21:26

Ivan,

The changes to the OptionLabel is what made this all work

  • .OptionLabel(new { Name = "Select PO ...", ID = "" })

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

Attached Files:
ADMIN
Ivan Danchev
Posted on: 09 Aug 2019 13:49
Hello Patrick,

I tested this scenario and at my end the correct value is returned on selection. Attached you can find a sample project that demonstrates this.

Note that I am getting the value in the DropDownList's Change event, not in the Select event. In the Select event the DropDownList has not yet changed the value from the previous to the new one, that is why the Change event should be used to get the new value:

Events configuration:
.Events(ev => ev.Change("onChange"))

Event handler:
<script>
    function onChange(e) {
        alert(e.sender.value());
    }
</script>

Let me know whether using the change event, as shown in the attached project resolves the issue, if not please modify the example accordingly so that the unexpected behavior is reproduced and attach it back for further review.

Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Attached Files: