Kendo window.refresh not successfully grabbing partial view

断了今生、忘了曾经 提交于 2019-12-02 13:11:58

问题


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>
}

来源:https://stackoverflow.com/questions/27323213/kendo-window-refresh-not-successfully-grabbing-partial-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!