How to force TelerikMultiSelect to reload data programtically?

1 Answer 44 Views
MultiSelect
John
Top achievements
Rank 2
Iron
Iron
Iron
John asked on 24 Sep 2024, 08:06 PM

I have a control that has a form on it.  That form has a MultiSelect control on it. The Multiselect is populated with records from a DB Table.  I have also added a button below the multiselect control that triggers a window control that allows the user to add a new record to that table.  When I close the window I would like to refresh the multiselect control without refreshing the whole form that it is part of.  How do I go about refreshing only the MultiSelect control?

  <TelerikMultiSelect @bind-Value="@AppState.Party.SelectedAssocFirmIds"
                                                TItem="AssocFirmDDL"
                                                Placeholder="Click here for existing firms or add a new one."
                                                TValue="int"
                                                ValueField="Id"
                                                TextField="Name"
                                                OnRead=@ReadAssocFirms
                                                AdaptiveMode="AdaptiveMode.Auto"
                                                Filterable="true"
                                                Id="AssocFirms"
                                                Width="90%">
                            </TelerikMultiSelect>
                            <TelerikButton Icon="SvgIcon.Plus" OnClick="@(()=>AssocFirmWindowIsVisible=!AssocFirmWindowIsVisible)">Add New Firm</TelerikButton>

  private async Task ReadAssocFirms(MultiSelectReadEventArgs args)
    {
        try
        {
            DataSourceRequest dsr = CreateDataSourceRequest();
            var assocFirms = await AssocFirmServices.GetAssocFirmsOnly(dsr);
            args.Data = mapper.Map<List<AssocFirm>, List<AssocFirmDDL>>(assocFirms.AssociatedFirms);
        }
        catch (Exception ex)
        {
            logger.LogError($"Error reading Associated firms for DDL.", ex.GetBaseException().Message);
            throw;
        }
    }


John
Top achievements
Rank 2
Iron
Iron
Iron
commented on 26 Sep 2024, 02:15 PM

This has been resolved.  And should be considered closed.

1 Answer, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 27 Sep 2024, 04:59 AM

Hello John,

Thank you for the update. I'm glad to hear that you've resolved the matter on your own. Now I'm closing the ticket.

Regards,
Tsvetomir
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
MultiSelect
Asked by
John
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Tsvetomir
Telerik team
Share this question
or