I have this kendo window in my app
Html.Kendo().Window()
.Name("copyStructure")
.Title("Copy Structure")
.Content("Loading...")
.LoadContentFrom("CopyStructure", "NewXmlLayout") // <-- here*
.Draggable(false)
.Visible(false)
.Modal(true)
.Actions(s => s.Custom(""))
.Events(e => e.Open("openWindow").Close("closeWindow"))
And I am trying to pass data to the acrion in the LoadContentFrom() wich is returned by a javascript function, but I don't know how to do it. I can pass data like this:
.LoadContentFrom("CopyStructure", "NewXmlLayout", new { type= "INPUT" })
But is not what I'm looking for.
The JS function:
function getInfo() {
return { type: "INPUT" };
};
My controller:
public ActionResult CopyStructure(string type)
{
return PartialView();
}
If you really need to access your data via the JavaScript
getInfo()
function, then the way to do this is to define the Window as you are doing but don't set the content until you open the window. When opening the Window, usejQuery.ajax()
to callCopyResult
, passing the results ofgetInfo()
into the data parameter.In your Razor, take out
LoadContentFrom
add an event handler for theOpen
event:And in your handler in JavaScript, call
$.ajax
and in thesuccess
callback, call thecontent
method on the Window object passing the returneddata
as the parameter:Beware to only send what's required for the window content, and not a full page (DOCTYPE, html, head, body) - see this documentation from Telerik: http://docs.telerik.com/kendo-ui/getting-started/web/window/overview#loading-window-content-via-ajax