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

Kendo Window not rendering dropdown list

9 Answers 974 Views
Window
This is a migrated thread and some comments may be shown as answers.
Atul
Top achievements
Rank 1
Atul asked on 19 Mar 2014, 11:40 AM
Hi All,


I have created partial view which contain multiple dropdown list and I am rendering this partial view on different Window. 

When I opened this partial view on "xyz" window it will work as expected, but when I opened same partial view on another window (abc) all dropdownlist converted into textbox control.

Any thoughts?

Thanks-
Atul K

9 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 19 Mar 2014, 02:16 PM
Hi Atul,

If you load the same partial view multiple times on the same page, you need to use different IDs and Name()'s for all elements and Kendo UI widgets, otherwise you will end up with duplicate IDs on the page and the HTML markup will become invalid.

Regards,
Dimo
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Atul
Top achievements
Rank 1
answered on 20 Mar 2014, 06:19 AM
Hi Dimo, thanks for your reply.

Here I am rendering partial view on different Windows and I am closed the window before opening another window.

and you suggested use different IDs for all elements, so how can assign different ID's for all elements from Partial view?

Thanks-
Atul 
0
Dimo
Telerik team
answered on 20 Mar 2014, 07:01 AM
Hi Atul,

Closing a Window does not remove it from the DOM. If you will not be needing a particular Window again, you can destroy() it in its deactivate event. In this way you will not have to use different IDs for the content in the new instances.

http://docs.telerik.com/kendo-ui/getting-started/web/window/overview#destroying-a-kendo-ui-window

http://docs.telerik.com/kendo-ui/api/web/window#events-deactivate

Applying unique Names to the Kendo UI widgets inside the Window is a general development task, which involves using string variables and is not directly related to Kendo UI. Imagine you have a plain textbox (<input type="text" id="MyTextBox" />) inside a partial view, which will be loaded multiple times on a page. How will you apply different IDs to each textbox instance?

Regards,
Dimo
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Atul
Top achievements
Rank 1
answered on 20 Mar 2014, 08:54 AM
Thanks Demo,

This elucidation is work for me. I have removed all elements from Window on deactivate event of window.

 deactivate: function () {
                $(this.element).empty();
            }

Please correct me if this approve is not correct or do you have any other better approach to resolved my issue.

Thanks-
Atul K.
0
Dimo
Telerik team
answered on 20 Mar 2014, 09:12 AM
Hi Atul,

Before removing DOM content, which contains Kendo UI widgets, it is highly recommended to call kendo.destroy().

http://docs.telerik.com/kendo-ui/api/framework/kendo#methods-destroy

Regards,
Dimo
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 06 Mar 2018, 02:31 PM

Hi Dimo,

I have a similar problem. The window is loading its content like:

Html.Kendo().Window().LoadContentFrom(actionName, controllerName)

And every time I want to open the window I do

window.refresh();
window.center(true).open();

And for closing I do this

 

$("#window").data("kendoWindow").close();

Also the partial view contains the kendo dropdownlist.

When I wrote the code at the first run the dropdownlist was working correctly. I had opened the window several times and I had the dropdownlist correctly.

At one point the VS was stuck and I had to kill the process, and after that the dropdownlist in the window was not working anymore correctly. 

After I discovered that it does not work I tried another browser and surprisingly for the first time the dropdownlist in window worked but the second time in the same browser it did not.

Now I have the question: When you say use kendo.destroy you mean to use it only on window or also on any kendo widget inside the window? What is the protocol for such a case?

0
Dimo
Telerik team
answered on 07 Mar 2018, 08:18 AM
Hi Dan,

kendo.destroy() needs to be executed for the Window's content container (the widget's element), but only if you remove the content manually, as in the above snippet by Atul.

https://docs.telerik.com/kendo-ui/intro/widget-basics/wrapper-element

When you call the refresh() method of the Window, the widget calls kendo.destroy() internally in its content() method...

https://github.com/telerik/kendo-ui-core/blob/master/src/kendo.window.js#L1352

... which is called when the partial view is loaded:

https://github.com/telerik/kendo-ui-core/blob/master/src/kendo.window.js#L754

You code looks OK. Please make sure that there is no duplicate Window initialization somewhere in the JavaScript.

https://docs.telerik.com/kendo-ui/intro/installation/jquery-initialization#duplicate-initialization

If you need further assistance, please send an isolated runnable demo, so that I can inspect it.

Regards,
Dimo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 07 Mar 2018, 08:24 AM

Hi Dimo,

Thank you for the clarifications. After further investigation I found out that I had the same id on two dropdownlist. On the page I had a grid and two windows: one for add and one for edit. At first I added the dropdownlist on the add window and it worked. But then I just copied and paste in the edit the same dropdownlist. After that only the edit window was working.

So I have to be more careful with the copy and paste :D

0
Dimo
Telerik team
answered on 07 Mar 2018, 09:32 AM
Thanks for the follow-up, Dan, I am glad you discovered the culprit.

Regards,
Dimo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
ramesh
Top achievements
Rank 1
commented on 12 Sep 2022, 06:00 PM | edited

Hi Team,

I got the same issue, ASP.Net core Dropdownlist is rendering as textbox in partial view. I have the unique id for the dropdown. There is no destroy event for .net core control. Any fix for this issue?

Regards,

Ramesh A

Momchil
Telerik team
commented on 14 Sep 2022, 08:32 AM

Hello Ramesh,

Is this issue separate from the one in the support ticket that you opened on September 13th?

In case it is, please send a code snippet including your configuration so that I can investigate the problem.

Best Regards,
Momchil
Progress Telerik

 

ramesh
Top achievements
Rank 1
commented on 14 Sep 2022, 08:39 AM

This is the same issue, Please ignore it. Thanks
Tags
Window
Asked by
Atul
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Atul
Top achievements
Rank 1
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or