Dropdownlist inside Grid EditTemplate

Hi, I can get the dropdown list to populate correctly from a remote datasource.  But when I put the same code within the EditTemplate of the grid the Category data is not displayed and I just get a list of Commodity IDs.  Could you please advise me what I'm doing wrong?  

@*List of Categories - Working correctly*@
@*<SfDropDownList ID="CategoryId" Placeholder="Select Category" TValue="int?" TItem="TblCategory">
    <SfDataManager Adaptor="Adaptors.CustomAdaptor">
            <CategoriesAdaptor></CategoriesAdaptor>
        </SfDataManager>
    <DropDownListFieldSettings Value="CategoryId" Text="Category"></DropDownListFieldSettings>
</SfDropDownList>*@

@*Grid with List of Categories - Not displaying list of Categories*@
<SfGrid @ref="CommodityGrid" TValue="TblCommodity" Toolbar="ToolbarItems" AllowPaging="true">
    <SfDataManager Adaptor="Adaptors.CustomAdaptor">
        <CommoditiesAdaptor></CommoditiesAdaptor>
    </SfDataManager>
    <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
    <GridPageSettings PageSize="10"></GridPageSettings>
    <GridColumns>
        <GridColumn Field=@nameof(TblCommodity.CommodityId) HeaderText="Commodity ID" Visible="true" IsPrimaryKey="true" IsIdentity="true" TextAlign="TextAlign.Right" Width="120"></GridColumn>
        <GridColumn Field=@nameof(TblCommodity.CommodityName) HeaderText="Commodity Name" Width="120"></GridColumn>

        <GridColumn Field=@nameof(TblCommodity.CategoryId) HeaderText="Category" TextAlign="TextAlign.Right" Width="120" EditType="EditType.DropDownEdit">
            <EditTemplate>
                <SfDropDownList ID="CategoryId" Placeholder="Select Category" TValue="int?" TItem="TblCategory">
                    <SfDataManager Adaptor="Adaptors.CustomAdaptor">
                        <CategoriesAdaptor></CategoriesAdaptor>
                    </SfDataManager>
                    <DropDownListFieldSettings Value="CategoryId" Text="Category"></DropDownListFieldSettings>
                </SfDropDownList>
            </EditTemplate>
        </GridColumn>

        <GridColumn Field=@nameof(TblCommodity.CImageFilename) HeaderText="Image Path" TextAlign="TextAlign.Right" Width="120"></GridColumn>
    </GridColumns>
</SfGrid>



Thanks

4 Replies 1 reply marked as answer

MI Michael July 14, 2020 12:55 AM UTC

I've also tried the following method of assigning the DropDownList datasource

        <GridColumn Field=@nameof(TblCommodity.CategoryId) HeaderText="Category" EditType="EditType.DropDownEdit">
            <EditTemplate>
                <SfDropDownList ID="CategoryId" Placeholder="Select Category" TValue="int?" TItem="TblCategory" DataSource="@CategoryList">
                    <DropDownListFieldSettings Value="CategoryId" Text="Category"></DropDownListFieldSettings>
                </SfDropDownList>
            </EditTemplate>
        </GridColumn>

@code{
    public List<TblCategory> CategoryList { get; set; }

    protected override async Task OnInitializedAsync()
    {
        IEnumerable<TblCategory> CategoryData = await UtilitiesScopeClient.GetCategories();
        CategoryList = CategoryData.ToList();
    }
}

With either option, the EditTemplate seems to be completely ignored.  If I remove the EditTemplate block, I get exactly the same result.

SyncFusion Blazor version 18.2.0.44.  Visual Studio 2019 version 16.7 Preview 3.1.

Thanks


DR Dhivya Rajendran Syncfusion Team July 14, 2020 08:08 AM UTC

Hi Michael,  

Greetings from Syncfusion support.   

Query: the EditTemplate seems to be completely ignored 
 
We have validated the reported problem and we are able to reproduce the reported issue at our end too. We have confirmed it is a bug and logged the defect report “Need to Handle EditTemplate when using dialog edit mode in Grid” for the same. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our upcoming Patch release which is expected to be rolled out on July 21, 2020.  
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link. 


Until then we appreciate your patience.  

Regards, 
R.Dhivya 


Marked as answer

JB jose benitez February 27, 2021 01:03 AM UTC

I am using version 18.4.0.43 and this problem continues, it does not show the Category in the grid, and when editing the list is not seen


RN Rahul Narayanasamy Syncfusion Team March 1, 2021 01:19 PM UTC

Hi Jose, 

Greetings from Syncfusion. 

Query: Edittemplate – Datasource not shown - I am using version 18.4.0.43 and this problem continues, it does not show the Category in the grid, and when editing the list is not seen 

We have validated your query and checked the reported problem. We could not face the problem in the mentioned version. The Dropdown DataSource is shown properly when rendered the dropdown list in EditTemplate. Find the below sample for your reference. 


If you are still facing the problem, then could you please share the below details. 

  • Reproduce the problem in the provided sample and revert back to us.
  • Full Grid code snippets.
  • Share .Net version details and Syncfusion NuGet version details.
  • Share a simple reproduceable sample.

The above information will be helpful to validate and provide a better solution as early as possible. 

Regards, 
Rahul 


Loader.
Up arrow icon