We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Assign value from dropdownlist on change

Thread ID:





130702 May 26,2017 05:32 PM UTC May 29,2017 07:09 AM UTC ASP.NET Core 1
Tags: DropDownList
karen anderson
Asked On May 26, 2017 05:32 PM UTC

I have a dropdownlist which contains value, text and estimatedHours, how can I estimatedHours  to another input field on change?

<ej-drop-down-list id="serviceList"
                        watermark-text="Select a service"
                        template="<div> ${text} </div> <div class='estHrs'>${estimatedHours} </div>">
                        <e-drop-down-list-fields text="text" estimatedHours="estimatedHours"/>

<ej-numeric-text-box id="EstimatedHours" decimal-places="1" ej-for="@Model.Trade.EstimatedHours" increment-step=".5" />

         function serviceList_change(args) {

             var dropdownObj = $("#serviceList").ejDropDownList('instance');



Prince Oliver [Syncfusion]
Replied On May 29, 2017 07:09 AM UTC

Hi Karen,   
Thank you for contacting Syncfusion support.   
To set ‘estimatedHours’ field in dropdownlist datasource to another input field on change event, we need to get the ‘estimatedHours’ field based on the selected text value from the dropdownlist and then set it to numeric textbox. Kindly refer to the following code snippet.   

    function serviceList_change(args) { 
        var dropdownObj = $("#serviceList").ejDropDownList('instance'); 
        var numericObj = $("#EstimatedHours").data("ejNumericTextbox"); 
        var selectedhour; 
        for(i = 0; i < dropdownObj.model.dataSource.length; i++) {  
            if (dropdownObj.model.dataSource[i].text == args.selectedText) {  
                selectedhour = dropdownObj.model.dataSource[i].EstimatedHours 
        numericObj.setModel({ value: selectedhour }); 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon