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

ASP.NET Core - Razor Page - DropDownEdit Empty - not displaying list in Grid


I have a grid in a razor page (.net core 2.2) containing 2 dropdownedits. The first one render fin, but the second one displays as an empty list.
Can you please help ?

List<string> toolbarCommands = new List<string>() { "ExcelExport", "Search", "Add" };

List<object> gridInlineCommands = new List<object>();
gridInlineCommands.Add(new { type = "Delete", buttonOption = new { iconCss = "e-icons e-delete", cssClass = "e-flat" } });

var providerNameValidationRules = new Dictionary<string, object>() { { "required", true }, { "minlength", 5 } };

var dsStateNames = new List<object>() { new { StateName = "California" }, new { StateName = "Florida" }, new { StateName = "North Carolina" } };
var editParamsStateNamesDdlList = new { @params = new { dataSource = dsStateNames, fields = new { value = "StateName" } } };
var stateNameValidationRules = new Dictionary<string, object>() { { "required", true } };

var dsCredentialsTypes = new List<Object>() { new { CredentialType = "APNP" }, new { CredentialType = "CM" }, new { CredentialType = "DO" } };
var editParamsCredentiaslTypesDdlList = new { @params = new { dataSource = dsCredentialsTypes, fields = new { value = "CredentialType" } } };

<div id="container">
<ejs-grid id="Grid" allowPaging="true" load="onLoad" toolbarClick="toolbarClick" toolbar="toolbarCommands" allowSorting="true" allowFiltering="true" allowExcelExport="true" actionFailure="failure">
<e-data-manager url="Index?handler=DataSource" insertUrl="Index?handler=Insert" updateUrl="Index?handler=Update" removeUrl="Index?handler=Delete" adaptor="UrlAdaptor"></e-data-manager>
        <e-grid-editsettings allowAdding="true" allowDeleting="true" allowEditing="false" showDeleteConfirmDialog="true" mode="Dialog"></e-grid-editsettings>
        <e-grid-filterSettings type="CheckBox"></e-grid-filterSettings>
        <e-grid-pageSettings pageCount="10" pageSize="15"></e-grid-pageSettings>
<e-grid-column field="Id" headerText="Id" isPrimaryKey="true" textAlign="Left" width="20" visible="false"></e-grid-column>
            <e-grid-column field="ProviderName" headerText="Provider Name" width="150"></e-grid-column>
            <e-grid-column field="StateName" headerText="State" textAlign="Left" width="120" editType="dropdownedit" edit="editParamsStateNamesDdlList" validationRules="stateNameValidationRules"></e-grid-column>
            <e-grid-column field="Credentials" headerText="User Credentials" textAlign="Left" width="120" editType="dropdownedit" edit="editParamsCredentiaslTypesDdlList"></e-grid-column>
            <e-grid-column headerText="Manage Records" width="120" commands="gridInlineCommands"></e-grid-column>

3 Replies

PS Pavithra Subramaniyam Syncfusion Team April 15, 2019 12:24 PM UTC

Hi moez, 
Thanks for contacting Syncfusion support. 
From your code example we have found that you are using different data field(“CredentialType”) for DropDownList Component from the column field(“Credentials”) which is the cause of the reported behavior. So we suggest you to use the dataSource that contains the field as same as the column based on which mapping will be done. 
Please get back to us if you need any further assistance on this.  
Pavithra S. 

MO moez April 15, 2019 05:03 PM UTC

Thank you Pavithra !
That solved my problem.

PS Pavithra Subramaniyam Syncfusion Team April 16, 2019 04:12 AM UTC

Hi moez,  

Thanks for your update. 

We are happy to hear that your problem has been solved. 

Please contact us if you need any further assistance. As always, we will be happy to assist you.  

Pavithra S. 

Live Chat Icon For mobile
Up arrow icon