全部。先感谢您。
我有一个窗口,每次更改下拉选择(或按下按钮)时都会刷新很多。控制器在刷新时被调用,但由于某种原因视图没有被调用/刷新。我错过了一些基本的东西吗?
窗户:
@(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())
)
刷新代码(在 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"
});
控制器:
[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."); }
}
我知道部分视图工作正常,因为它在初始窗口加载时被调用并填充。为什么我不能让它刷新?
编辑:这是我的部分视图(窗口内容):
@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>
}