Post data from template after kendo window close

3 posts, 1 answers
  1. Kelly
    Kelly avatar
    28 posts
    Member since:
    Oct 2012

    Posted 19 Jul 2013 Link to this post

    Is it possible to post data back to a controller using a FormCollection object? I would like a user to be able to open a kendo window and select, by way of a checkbox, multiple entries. Then close the window, change data on the parent page and then submit the form (note: the kendo window div exists inside the form). I can get the kendo window to open and display all the data via a listview but I'm not sure how to get the checkbox values (the only piece of the kendo window the user can edit) back to my controller. I suspect kendo might be destroying all the data selected when the window is closed (note: I do not call the destroy command on the window) so I figured I could always create a bunch of hidden fields on the parent page and update them as the user checks off the check boxes but I was trying to avoid that.

    I can always change my controller to a DataSource Object but I'd like to avoid rewriting code. The controller called is 
    [HttpPost]
    ActionResult BrowseTeeTimes(string club FormCollection formData)
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 23 Jul 2013 Link to this post

    Hello Paul,

    Please notice that you cannot position the Window inside a form element - this is because the content of the Window is not actually inside the form element. The whole content is appended to the body of the HTML document.

    You can inspect the DOM for the following CSHTML:

    @using (Ajax.BeginForm("BrowseTeeTimes", new AjaxOptions() { Url = "test/test" }))
    {
        Html.Kendo().Window().Name("test").Content(@<text>
     
     
                                <table class="grid7">
                                    @(Html.Kendo().ListView(Model)
                                        .ClientTemplateId("facilitiesTemplate")
                                        .HtmlAttributes(new { style = "border-width:0px" })
                                        .Name("facilitiesList")
                                        .TagName("tbody")
                                    )
                                </table>
     
     
        <input type="submit" name="name" value=" " />
                                 
     
     
         </text>).Render();
    }

    The DOM actually looks like in the attached image:

    Kind Regards,
    Petur Subev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Answer
    Kelly
    Kelly avatar
    28 posts
    Member since:
    Oct 2012

    Posted 24 Jul 2013 Link to this post

    Looking through the documentation again it seems the AppendTo property will work. I can get the data to the controller using this I'm just not sure if it'll be a long term solution due to the iframe issues.
Back to Top