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

[Solved] Telerik MVC Window Redirects to HttpResult Action on Submit in IE8

1 Answer 73 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jenna Guess
Top achievements
Rank 1
Jenna Guess asked on 20 Jun 2012, 07:43 PM

I am using a Telerik Window to display a custom Edit Form for a Telerik Grid.  The Telerik Window is in a form tag:

@using (Html.BeginForm("TestingAccommodationsEditPost", "TestingAccommodations", FormMethod.Post, new { id = "TestingAccommodationsEditForm" }))

and I have a submit button:

<button type="submit" class="t-button t-grid-insert">Save</button>

The submit JS is:

<script type="text/javascript">
    $('#TestingAccommodationsEditForm').submit(function (e) {
        if (!window._504.AccommodationPlan.TestingAccommodations.IsFormValid()) {
            return false;
        }
        else {
            var data = $(this).serialize();
            $.post(this.action, data, function () {
                $('#TestingAccommodationsEditForm').closest('.t-window').data('tWindow').close();
                $("#TestingAccommodations").data("tGrid").ajaxRequest();
            });
            e.preventDefault();
            return true;
        }
    });
 
</script>

The controller action is an EmptyResult with the following signature:

[HttpPost]
public EmptyResult TestingAccommodationsEditPost(TestingAccommodationsEditModel model)

The issue is that when I'm in IE8, submitting the Telerik Window results in the data being saved and a redirect to: http://localhost:19623/_504/TestingAccommodations/TestingAccommodationsEditPost.  It shouldn't do anything but save the data and close the Window.  Also if I watch IE Developer Tools, submitting the Telerik Window changes the Document Mode to 'Quirks'.

In IE9 it works correctly, on submit the Telerik Window closes so i can continue to interact with the page I was on.  Attached is the complete code related to this issue.  Can anyone advise on how to resolve this issue so that it works on IE8 just as well as it works in IE9?  We are using version 2011.2.712 of the Telerik MVC tools with MVC4.  Thank you.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 25 Jun 2012, 04:20 PM
Hello Jenna,

The code looks correct and I could not reproduce the described behavior on my side. The problem could be caused by the script used inside the Window's content, since it will be added twice to the page. Could you check if binding to the submit event from outside the Window resolves it?
If the problem persists, a sample project which replicates this behavior would help to determine what exactly is going wrong.

Regards,
Daniel
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
Window
Asked by
Jenna Guess
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or