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

Problem when submitting data in a Keno UI Window

3 Answers 187 Views
Window
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 29 Aug 2013, 07:03 PM
Hello,
I've got a problem with a page inside a Kendo ui page...
consider this code please

That's my main page calling a window
@{
    ViewBag.Title = "Index";
}
 
<h2>
    <button id="button" class="k-button">openWindow</button></h2>
 
 
 
@Html.Kendo().Window().Name("winTest").LoadContentFrom("Index", "TestWindow").Modal(true).Visible(false).Title("Prova");
<script>
    $(function () {
 
        $("#button").click(function () {
 
 
            $("#winTest").data("kendoWindow").open();
        }
        );
    });
</script>
Here's the content of the window I load
@{
    ViewBag.Title = "Index";
    Layout ="";
     
}
 
@using (Html.BeginForm("Inserisci"))
{
    <h1>Some text</h1>
    <input type="submit" value="Click me" class="k-button" />
}
And the test controller

public class TestWindowController : Controller
   {
       //
       // GET: /TestWindow/
 
       public ActionResult Index()
       {
           return View();
       }
       public EmptyResult Inserisci()
       {
           return null;
           //return EmptyResult
       }
 
   }

When I click on the button the main page is redirected to Index of TestWindow..... how can I fix this?

Another question how do I tell to the view inside the window to close itself after having done some update on the repository?

Thanks

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Sep 2013, 12:47 PM
Hello,

The Window content should be loaded in an iframe by using the Iframe option in order to avoid redirecting the mane page when the form is posted. Another option is to use an Ajax form with the Ajax.BeginForm helper so that the data is posted via Ajax. 
The window can be closed when needed by using its close method.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Michele
Top achievements
Rank 2
answered on 02 Sep 2013, 12:51 PM
Hello David,
If I load the content in an Iframe and inside there're some dropdown they'll not show over the window but a vertical scroll will appear... the Ajax helper should be used in the main or in the loaded window?
Thanks
0
Daniel
Telerik team
answered on 04 Sep 2013, 09:07 AM
Hello again,

The Ajax.BeginForm helper should be used in the window content instead of the Html.BeginForm helper.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Window
Asked by
Michele
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Michele
Top achievements
Rank 2
Share this question
or