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

ComboBox not working when acquired through Ajax Actionlink

6 Answers 128 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Yngve
Top achievements
Rank 1
Yngve asked on 09 Jun 2017, 01:53 PM

Hi,

 

I have an Ajax action link which GETs a partial view and insert it after a certain div on my page. That partial view contains a Kendo ComboBox which is bound to a SelectList in my model. But the ComboBox doesn't work at all when the partial has been inserted. None of the styling and functionality is there at all. In fact, all the kendo html is gone. There are no elements with the "k-combobox" and "k-widget" stuff. Everything is gone, and all I'm left with is

 

<input data-val="true" data-val-number="Feltet Prosjekt må være et tall." id="Sections_8fcdf2f0-53c3-45e3-9498-41aeaccf3ad4__ProjectId" name="Sections[8fcdf2f0-53c3-45e3-9498-41aeaccf3ad4].ProjectId" type="text" value="1">
<script>
    jQuery(function(){jQuery("#Sections_8fcdf2f0-53c3-45e3-9498-41aeaccf3ad4__ProjectId").kendoComboBox({"dataSource":[{"Text":"Testprosjekt","Value":"1"},{"Text":"asd","Value":"2"},{"Text":"Ttest","Value":"3"},{"Text":"asd","Value":"4"},{"Text":"Best Project Ever","Value":"5"},{"Text":"test2000","Value":"6"},{"Text":"asdiasd","Value":"7"},{"Text":"ghghj","Value":"8"},{"Text":"sdfsd","Value":"9"},{"Text":"rtrtfgh","Value":"10"}],"dataTextField":"Text","dataValueField":"Value","placeholder":"Velg prosjekt...","suggest":true});});
</script>

 

 

 

 

 

 

6 Answers, 1 is accepted

Sort by
0
Yngve
Top achievements
Rank 1
answered on 09 Jun 2017, 02:00 PM

Isn't it possible to edit my post?

Anyways.. I ment to say an EditorTemplate. Not a partial.

0
Joana
Telerik team
answered on 13 Jun 2017, 11:21 AM

Hello Yngve,

 

 

I am afraid the information you have provided is not sufficient to define the cause of the issue. Make sure that you have correctly fulfilled all steps explained here: 

 

http://docs.telerik.com/aspnet-mvc/introduction#next-steps

 

Other useful articles:

 

http://docs.telerik.com/aspnet-mvc/helpers/combobox/overview#the-basics

 

http://docs.telerik.com/aspnet-mvc/introduction#next-steps

 

http://www.telerik.com/forums/how-to-add-combobox-to-editor-template-using-grid-pop-up

 

You could send us a sample with the code in your project so that we could examine it on our side and provide a solution.

 

Regards,
Joana
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Yngve
Top achievements
Rank 1
answered on 15 Jun 2017, 10:56 AM

Here is a project I made with an example in Home/Index

 

Dropbox link

0
Accepted
Ianko
Telerik team
answered on 19 Jun 2017, 07:17 AM

Hello Yngve,

The described behavior happens because the AJAX call from the Ajax.ActionLink does not evaluate JavaScript. You can read more about that here: https://stackoverflow.com/questions/1840620/asp-net-mvc-run-javascript-in-partialview-when-loaded-using-ajax-actionlink. Thus, the JavaScript logic outputted from the wrapper is never run so to.

I would suggest you implementing this by using jQuery.ajax method instead. As suggested in StackOverflow.

Regards,
Ianko
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Yngve
Top achievements
Rank 1
answered on 21 Jun 2017, 08:16 AM
Hi, thanks for the answer. I changed it so I'm using jQuery.ajax now, but there's still an issue. My page has the ability to load in a section with the ajax link. And it's the section that contains the combobox. When I try to load the first section everything is fine. But if I try to load another section, the same problem occurs.
0
Yngve
Top achievements
Rank 1
answered on 21 Jun 2017, 08:17 AM
Nevermind. Seemed to be an issue with using the name property, because they were all being named the same. Removed name and it works.
Tags
ComboBox
Asked by
Yngve
Top achievements
Rank 1
Answers by
Yngve
Top achievements
Rank 1
Joana
Telerik team
Ianko
Telerik team
Share this question
or