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

Post data from template after kendo window close

2 Answers 138 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kelly
Top achievements
Rank 1
Kelly asked on 19 Jul 2013, 09:05 PM
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 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 23 Jul 2013, 03:45 PM
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!
0
Accepted
Kelly
Top achievements
Rank 1
answered on 24 Jul 2013, 12:05 PM
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.
Tags
General Discussions
Asked by
Kelly
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Kelly
Top achievements
Rank 1
Share this question
or