Home > database >  kendo dropdownlist always select the first option from list
kendo dropdownlist always select the first option from list

Time:03-08

the value of this column is East Region Group. But when i click on the select list it always highlight the first option. I do not know what is the problem. Below are the code snippets.

Dropdownlist

PriceGrpList

DefaultPriceGroup

        var guid = kendo.guid();
        $('<input name="DefaultPriceGroup" id="'   guid   '" />').appendTo(container);
        ddt = $(container).find('#'   guid);

        dataItem = options.model;
        $(ddt).kendoDropDownList({
            name: "DefaultPriceGroup",
            value: dataItem.DefaultPriceGroup,
            dataSource: dataItem.PriceGrpList,
            dataTextField: "Text",
            dataValueField: "Value",
        });

CodePudding user response:

I think what is happening is your server-side code to return the DefaultPriceGroup is returning the record's text rather than the record's value (presumably an Id column).

Without knowing the schema of your PriceGroup view model, I'm making an assumption here, but I think you will need to change the server-side code to something like:

DefaultPriceGroup = _cfgPriceGroupService.GetPriceGroupByPriceGroupCd(x.PriceGrp_cd).PRICEGRP_ID

Take a look at this fiddle: https://dojo.telerik.com/AHIteQep

  • Related