Hi
I have this issue with KendoUI window control. I will add some code as well.
My view with window opening logic.
FirstAction in Controller returns this:
_MainWindowContent contains:
_FirstStep contains:
FirstStep contains some logic and then return partial view "SecondStep" with some more new fields. I thought it should update the div with the id of "popupDiv". This is at least how it worked in telerik window control, which I also used a bit. But what it does on my machine is that, it just goes straight to {site}/Controller/FirstStep, that is what I see on the browser address. The whole page contains only elements from SecondStep partial view. The controller FirstStep gets all the data correctly. Is there any way to post data or update window or am I missing some attributes or something?
I have this issue with KendoUI window control. I will add some code as well.
My view with window opening logic.
@(Html.Kendo().Window()
.Name("window")
.LoadContentFrom("FirstAction", "Controller", new { area = ""})
.Modal(true)
.Visible(false)
)
<
script
type
=
"text/javascript"
language
=
"javascript"
>
function openModalForm(e) {
e.preventDefault();
var windowElement = $('#window').data("kendoWindow");
windowElement.refresh();
windowElement.center();
windowElement.open();
}
</
script
>
<
span
>@Html.ActionLink("Link to open window", "Action", Controller", new { area = "" }, new { onclick = "javascript:openModalForm(event);" })</
span
>
FirstAction in Controller returns this:
public
ActionResult FirstAction()
{
return
PartialView(
"_MainWindowContent"
,
new
MyModel());
}
_MainWindowContent contains:
@model MyWeb.Models.MyModel
<
div
class
=
"popup"
id
=
"popupDiv"
>
@{
Html.RenderPartial("_FirstStep", Model);
}
</
div
>
_FirstStep contains:
@model MyWeb.Models.MyModel
<
div
class
=
"form"
>
<
h1
class
=
"step-1"
>Form field title</
h1
>
<
div
class
=
"form-list"
>
@using (Ajax.BeginForm("FirstStep", "Controller", null, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "popupDiv", InsertionMode = InsertionMode.Replace }, new { id = "mainForm" }))
{
<
ul
>
<
li
class
=
"form-field"
id
=
"firstField"
>
@Html.LabelFor(m => m.FirstField, "First field")
<
div
class
=
"input-box"
>
@Html.TextBoxFor(m => m.FirstField)
</
div
>
</
li
>
<
li
class
=
"form-field"
id
=
"secondField"
>
@Html.LabelFor(m => m.SecondField)
<
div
class
=
"input-box"
>
@Html.TextBoxFor(m => m.SecondField)
</
div
>
</
li
>
<
li
class
=
"form-field"
id
=
"thirdField"
>
@Html.LabelFor(m => m.ThirdField)
<
div
class
=
"input-box"
>
@Html.TextBoxFor(m => m.ThirdField)
</
div
>
</
li
>
<
li
class
=
"form-field"
id
=
"fourthDate"
>
@Html.LabelFor(m => m.FourthDate)
<
div
class
=
"password-box"
>
@Html.Kendo().DatePickerFor(m => m.FourthDate)
</
div
>
</
li
>
</
ul
>
@Html.HiddenFor(m => m.HiddenValue)
}
</
div
>
<
div
class
=
"popup-navigation"
>
<
button
id
=
"nextButton"
> Go to next step </
button
>
</
div
>
</
div
>
<
script
type
=
"text/javascript"
language
=
"javascript"
>
$("#nextButton").click(function () {
$("#HiddenValue").val("true");
$("#mainForm").submit();
});
</
script
>
</
div
>
FirstStep contains some logic and then return partial view "SecondStep" with some more new fields. I thought it should update the div with the id of "popupDiv". This is at least how it worked in telerik window control, which I also used a bit. But what it does on my machine is that, it just goes straight to {site}/Controller/FirstStep, that is what I see on the browser address. The whole page contains only elements from SecondStep partial view. The controller FirstStep gets all the data correctly. Is there any way to post data or update window or am I missing some attributes or something?