I am stuck at what appears to be a very simple scenario:
Loading a Kendo window with a partial view bound to a model, with a dynamic parameter modelId
that will be provided by client side js.
I found out about the refresh()
method, but this implies that there is already a kendo window intialized. That's the first problem. I need the the modelId
to display content.
So I worked around this issue and simply returned a new model intially which than should be replaced/refreshed by the refresh()
method + a valid parameter modelId
and finally be displayed.
Problem: The view won't be updated.
The refresh()
method actually works, though.
The controller receives the parameter modelId
, fetches the corresponding model and returns the view. But the Kendo window still holds the empty viewmodel instead.
I tryed really hard to get this to work but without success..
@(Html.Kendo().Window()
.Name("window")
.Title("")
//loads an empty viewmodel intially as there is no possibility to pass parameter
.LoadContentFrom("Actionname", "Controller")
.Actions(actions => actions.Close())
.Modal(true).Visible(false)
.HtmlAttributes(new {style = "margin: 10px"})
)
Javascript snippet:
$("#window").data("kendoWindow").refresh({
url: '/controller/actionname/',
data: { parameterlabel: parameter}
});
$("#window").data("kendoWindow").open().center(true);
Not sure if this solves your main issue, but you should be able to do this:
@(Html.Kendo().Window()
.Name("window")
.Title("")
.LoadContentFrom("Actionname", "Controller", new { modelID = modelId })
.Actions(actions => actions.Close())
.Modal(true).Visible(false)
.HtmlAttributes(new {style = "margin: 10px"})
)
Then you won't need to load the empty model and refresh it with the correct parameter.