Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
webdropdown client databind can not get select_value
posted

hi,when i set datasource to webdropdown,the dropdownitem's text display looks good ,but when i  raise client SelectionChanged events,the sender.get_selectedItem().get_value() always return empty, how can i get the selecteditem's value.

//json  

var faulData = [{ "SMSFaultCodeID": "1", "FaultCodeName": "error_A"}];


        function onDataBind(sender, evntArgs) {
            evntArgs.set_cancel(true);
            sender._pi.show(sender);
            $.ajax({
                url: "products",
                contentType: "text/json; charset=utf-8",
                dataType: "json",
                success: function (datatsource, st) {
                    //dataSource = datatsource.data.results;
                     dataSource=faulData ;

                    sender.set_dataSource(dataSource);
                    sender.dataBind();
                    sender._pi.hide(sender);
                },
                error: function () {
                    alert("Error with AJAX callback");
                }
            });
        }

        function onSelectionChanged(sender, evntArgs) {
            var selectvalue= sender.get_selectedItem().get_value().toString();
        }

 

 <ig:WebDropDown ID="myDropDown" runat="server" ClientIDMode="Static" Width="200px"
        EnableClientRendering="true" DropDownContainerMaxHeight="200" EnableDropDownAsChild="false"
        AutoPostBackFlags-SelectionChanged="Off" TextField="FaultCodeName" ValueField="SMSFaultCodeID"
        AutoPostBack="false" ClientEvents-DataBinding="onDataBind" DisplayMode="DropDown">
        <ClientEvents SelectionChanged="onSelectionChanged" />
    </ig:WebDropDown>