所有。先感谢您。
我有一个窗口,每次更改下拉选项(或按下按钮)时都会刷新。在刷新时调用控制器,但由于某种原因,视图未被调用/刷新。我错过了一些基本的东西吗?
窗口:
@(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>
}