This is a migrated thread and some comments may be shown as answers.

Multi Select Text after post

2 Answers 79 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 09 Dec 2020, 10:03 PM

After my page comes back after a post the selected items in the multi select are gone. The datasource http GET returns no items because it filters it base off text...

RAZOR .cshtml

<kendo-multiselect for="SearchCriteria.SiteId" value="@Model.SearchCriteria.SiteId" datatextfield="Name"
                                   datavaluefield="Id" placeholder="Search for a Clinic" filter="FilterType.Contains"
                                   auto-bind="true" deferred="true">
                    <datasource server-filtering="true">
                        <transport>
                            <read url="@Model.SearchProvidersURL">
                        </transport>
                    </datasource>
                </kendo-multiselect>

 

RAZOR Model page

public string SearchProvidersURL => $"{Url.Page("ByClinic")}?handler=ProviderSearch";
        public async Task<JsonResult> OnGetProviderSearch(string text)
        {
            var providerSites = await _lookUpService.GetProviderSites(text);

             //No Results if text is less than 3 characters because there are too many sites. I would return 40,000 items
            return new JsonResult(providerSites);
        }

 

Can I write some javascript that could run after the post happens, I don't know what to do?

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Todd
Top achievements
Rank 1
answered on 09 Dec 2020, 10:06 PM

The runtime generated javascript has a value:6 with is the value I selected, but it doesn't not show as selected.

 kendo.syncReady(function(){jQuery("#SearchCriteria\\.SiteId").kendoMultiSelect({"dataSource":{"serverFiltering":true,"transport":{"read":{"url":"/FirstRequestCorrections/Reporting/ByClinic?handler=ProviderSearch","data":function()
{ return kendo.ui.MultiSelect.requestData(jQuery("#SearchCriteria\\.SiteId")); }}}},"autoBind":true,"placeholder":"Search for a Clinic","filter":"contains","value":"6","dataTextField":"Name","dataValueField":"Id"});})

0
Petar
Telerik team
answered on 14 Dec 2020, 02:05 PM

Hi Todd,

I will need more details about the scenario when the MultiSelect loses its values. If I am correctly understanding, you are using the MultiSelect in a form. When you select values in this form, everything is working correctly. When you submit the form, the selected MultiSelect data is properly sent to the code behind. Is the previous correct? 

Can you elaborate more on the exact scenario that you work on? In what context is the MultiSelect used? What do you expect to happen with the MultiSelect and what actually happens with it? 

Can you send me a runnable example in which I can replicate the reported issue? You can send me an isolated example in which the MultiSelect loses its values. Please also provide step-by-step instructions for the reproduction of the issue.

If you don't want to share your code, you can submit a support ticket which also will be answered within 24 hours. The requested project is needed because thus we will have the whole picture and be able to easily identify the source of the issue. 

Looking forward to your reply.

Regards,


Petar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
MultiSelect
Asked by
Todd
Top achievements
Rank 1
Answers by
Todd
Top achievements
Rank 1
Petar
Telerik team
Share this question
or