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

data doesn't show in dropdownlist,combobox,autocoplete ,..

<div class="control-section col-lg-12">
    <div id='remote-data' class="col-lg-6">
        <div class='content'>
            <h4>Remote Data</h4>
            <EjsAutoComplete @ref="@AutoComplete" placeholder="Select a name">
                <EjsDataManager Json="@AutoCompleteData" Adaptor="@Adaptors.JsonAdaptor"></EjsDataManager>
                <AutoCompleteFieldSettings Value="AllergyId" Text="AllergyName"></AutoCompleteFieldSettings>
            </EjsAutoComplete>
        </div>
    </div>
</div>

@code{

Allergies[] AutoCompleteData;

EjsAutoComplete AutoComplete;

protected override async Task OnAfterRenderAsync()
{
    AutoCompleteData =await http.GetJsonAsync<Allergies[]>("api/Allergies");
    }
}



[HttpGet]

        public object Get()
        {
            
            IEnumerable<Allergies> data = db.GetAll().AsQueryable();
            var count = data.Count();
            var queryString = Request.Query;
            if (queryString.Keys.Contains("$inlinecount"))
            {
                StringValues Skip;
                StringValues Take;
                int skip = (queryString.TryGetValue("$skip", out Skip)) ? Convert.ToInt32(Skip[0]) : 0;
                int top = (queryString.TryGetValue("$top", out Take)) ? Convert.ToInt32(Take[0]) : data.Count();
                return new { Items = data.Skip(skip).Take(top), Count = count };
            }
            else
            {
                return data;
            }
        }


3 Replies

BC Berly Christopher Syncfusion Team July 22, 2019 09:35 AM UTC

Hi Ebi,   
  
 
Sorry for the inconvenience. 

Currenlty, we are validating the reported problem and we will update the further information on July 24, 2019. 
  
  
Regards, 
Berly B.C 



BC Berly Christopher Syncfusion Team July 24, 2019 11:38 AM UTC

Hi Ebi,   
  
  
Thanks for the patience.  
  
  
We analyzed your code and found that you used the JSON Adapter and assigned the data returned by the API to DataManager which causes the problem. Instead, we recommend you to directly assign the data returned by the API to the DataSource property. 
  
 
[Index.razor] 
  
<div class="control-section col-lg-12"> 
    <div id='remote-data' class="col-lg-6"> 
        <div class='content'> 
            <h4>Remote Data</h4> 
            <EjsAutoComplete DataSource="@AutoCompleteData" placeholder="Select a name"> 
                <AutoCompleteFieldSettings Value="FirstName"></AutoCompleteFieldSettings> 
            </EjsAutoComplete> 
        </div> 
    </div> 
</div> 
 
@code{ 
 
 
   Employees[] AutoCompleteData; 
 
    protected override async Task OnInitAsync() 
    { 
        AutoCompleteData = await http.GetJsonAsync<Employees[]>("api/SampleData"); 
    } 
} 

  
Please find the sample below, 


  
Regards, 
Berly B.C 



ET ebi torabi July 26, 2019 06:48 PM UTC

Thank you so much for your example

Loader.
Live Chat Icon For mobile
Up arrow icon