Kendo window.refresh not successfully grabbing par

2019-03-02 22:39发布

问题:

all. Thank you in advance.

I have a window which much refresh every time a dropdown selection is changed (or button is pressed). The controller is being called upon refresh, but the view is not being called/refreshed, for some reason. Am I missing something fundamental?

Window:

@(Html.Kendo().Window()
    .Name("EditWindow")
    .Title("Edit Contact")
    .LoadContentFrom("_ContactEdit", "Contacts", new { selectedContact = Model.ContactId })
    .Content("Loading...")
    .Visible(false)
    .Draggable()
    .Resizable()
    .Width(400)
    .Modal(true)
    .Actions(actions => actions.Pin().Minimize().Maximize().Close())
)

Refresh code (in javascript):

    var combobox = $("#ContactId").data("kendoComboBox");
    var ContactId = combobox.value();
    var window = $("#EditWindow").data("kendoWindow");
    window.refresh({
        url: "../../Contacts/_ContactEdit",
        data: { selectedContact: ContactId }
        //url: "/Contacts/_ContactEdit/?selectedContact=ContactId"
    });

Controller:

[HttpGet]
public ActionResult _ContactEdit(int selectedContact)
{
    var entities = from r in dbContext.Contacts
                   where r.ContactId == selectedContact
                   select r;
    if (entities.Any())
    { return PartialView(entities.First()); }
    else
    { return HttpNotFound("Contact does not exist."); }
}

I know that the partial view is working correctly because it's called and populates upon the initial window load. Why in the world can't I get it to refresh?

edit: Here's my partial view (window contents):

@model PNC.CM.MBS.BizServiceTier.IIDB.Contact
@using Kendo.Mvc.Extensions

@using (Html.BeginForm())
{

    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    <fieldset id="infoForm">Hello, world.
    @Html.HiddenFor(model => model.ContactId, new { id = "EditWindowId" })
        <br />
        <label id ="ContactNameID" style="width: 130px;">Contact Name</label>
        <span>
            @Html.TextBoxFor(model => model.FullName, new { type = "text", id = "EditWindowName", @class = "k-textbox form-control", style = "width: 200px; cursor:default" })
        </span><br />
    </fieldset>
}