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

Window with Form inside

3 Answers 540 Views
Window
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 13 Mar 2018, 04:23 PM

Hi, I followed this doc page: https://docs.telerik.com/aspnet-mvc/helpers/window/using-forms-in-window

And it doesn't seem to work correctly. It executes the form's target action, but then just displays the returned <script> tag in the window rather than actually executing it.  Additionally, after manually closing the window, when I re-open it, the window content doesn't refresh automatically. What am I missing?

3 Answers, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 16 Mar 2018, 02:29 PM
Hi Robert,

Attached you will find a small MVC sample following the implementation form the article in question. It properly closes the Window when a valid text is passed to both inputs.

May I ask you to modify the attached so it reproduces the issue observed at your end and send it back to us? This way we will be able to troubleshoot the problem locally and to provide you with the most appropriate assistance for this case.

Regards,
Veselin Tsvetanov
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
Robert
Top achievements
Rank 1
answered on 16 Mar 2018, 02:42 PM

I'm unable to get it to reproduce the not-closing part with that sample, however I tweaked the code in the attached archive to include a button that opens the window the same way I am doing it, and you'll see after closing it the first time, if you re-open the window from the button the form content is gone -- it doesn't reload the AJAX content on the second showing.

Additionally, I notice this project is using ASP.NET MVC, while I'm using MVC Core 2 in my project - would that impact how this example behaves?

 

Rename the attachment to .Zip - the upload widget wouldn't accept it otherwise.

0
Veselin Tsvetanov
Telerik team
answered on 21 Mar 2018, 07:35 AM
Hi Robert,

As per the empty Window content after the first submit, the observed is expected. When clicking the Submit button for the first time, the response from the server returns only <script> wich will actually substitute the <form>. Therefore, the <form> will no longer be available in the Window content.

To resolve this issue you will need to explicitly force the Window to refresh its content:
function showWindow() {
    $("#PopupForm").data("kendoWindow").refresh().open();
...

As per the same scenario in .Net Core, I am afraid, that the same could not be achieved with the above implementation. Instead of submitting the form, you will need to send the data to the server with an AJAX request and execute the closing script in the its success handler.

Regards,
Veselin Tsvetanov
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.
Tags
Window
Asked by
Robert
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Robert
Top achievements
Rank 1
Share this question
or