Get more information with ِDropdown List

I have a list with like the list below

name

family

Job

Age

PersonnelCode



And  Send Data by ViewData 


And I created as follows





 <ejs-dropdownlist id="letterTOPerson" change="onChange" placeholder="select"  dataSource="@ViewData["ListUserInOrg"]" ejs-for="@Model.Send_To">
                             
                                
      <e-dropdownlist-fields value="PCode" text="name"   ></e-dropdownlist-fields>
   </ejs-dropdownlist>  

I want to be able to receive other information of that user when each user is selected. Such as Job
 and age
In the same view that should probably be done with JavaScript. is this possible?

1 Reply 1 reply marked as answer

JC Joseph Christ Nithin Issack Syncfusion Team March 8, 2021 11:48 AM UTC


Hello James Hols, 

   Greetings from Syncfusion software. 

   We have checked your query . It is possible to get the additional informations of the selected user in your dropdownlist by using the ‘args.itemData’ in the ‘change’ event. Kindly refer the below code snippet. 

<div class="control-wrapper"> 
    <div id="default" style='padding-top:75px;'> 
        <ejs-dropdownlist id="userInfo" dataSource="@ViewBag.data" change ="change"  placeholder="Select a user" popupHeight="220px"> 
            <e-dropdownlist-fields value="Vegetable">e-dropdownlist-fields> 
        ejs-dropdownlist> 
    div> 
div> 
 
 
<script type="text/javascript"> 
     
    function change(args) { 
        console.log(args.itemData); 
    } 
script> 

Sample: https://www.syncfusion.com/downloads/support/forum/163220/ze/ASPNetCore370907712

Please find the attached sample. And revert to us for more queries regarding this. 

Thanks, 
Joseph Christ Nithin I. 


Marked as answer
Loader.
Up arrow icon