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. Image for the cookie policy date
close icon

Error while creating combobox.

Hi ,
i having error when creating combobox.
As..
The call is ambiguous between the following methods or properties: 'Syncfusion.JavaScript.DropDownListPropertiesBuilder.Datasource(System.Collections.IEnumerable)' and 'Syncfusion.JavaScript.DropDownListPropertiesBuilder.Datasource(System.Action<Syncfusion.JavaScript.DataSourceBuilder>)'

Mycode is:
 @Html.EJ().DropDownList("CityMaster").WatermarkText("Select CityMaster").AllowVirtualScrolling(true).VirtualScrollMode(VirtualScrollMode.Normal).DropDownListFields(f => f.Value("Code").Text("Name")).EnableAnimation(true).EnableIncrementalSearch(true).CaseSensitiveSearch(false).Width("200").Datasource(ViewBag.City)
Please need your help.
What i am doing wrong.???

1 Reply

KR Keerthana Rajendran Syncfusion Team August 2, 2016 08:36 AM UTC

Hi Dhananjay,   
 Thank you for contacting Syncfusion support.   
 The issue might be due to conflict between the type of datasource referred, because ViewBag maintains the type of data. So we suggest you to do explicit conversion of data by using the below code in your sample   
  
<code>   
  
@Html.EJ().DropDownList("CityMaster").AllowVirtualScrolling(true).DropDownListFields(f =>f.ID("id").Text("text")).VirtualScrollMode(VirtualScrollMode.Normal).Datasource((IEnumerable<city>)ViewBag.datasource).WatermarkText("Select CityMaster").EnableAnimation(true).EnableIncrementalSearch(true).CaseSensitiveSearch(false).Width("200")   
</code>   
  

 
We have prepared a sample with your code snippet. Please check the below given sample    


 
Please let us know if any concern.   
  
Regards,   
Keerthana.  
 


Loader.
Live Chat Icon For mobile
Up arrow icon