Jquery 剑道UI窗口。刷新({data})未正确传递给ASP.NETMVC操作
我有一扇窗户:Jquery 剑道UI窗口。刷新({data})未正确传递给ASP.NETMVC操作,jquery,asp.net-mvc,kendo-ui,kendo-asp.net-mvc,kendo-window,Jquery,Asp.net Mvc,Kendo Ui,Kendo Asp.net Mvc,Kendo Window,我有一扇窗户: @(Html.Kendo().Window() .Name("wndInvoiceLineEditor") .Title("Invoice Line Item Editor") .Content("loading dialog...") .Height(350) .Width(785) .LoadContentFrom("InvoiceLineItemEditor", "Invoice", new { LineItemId = "Initial
@(Html.Kendo().Window()
.Name("wndInvoiceLineEditor")
.Title("Invoice Line Item Editor")
.Content("loading dialog...")
.Height(350)
.Width(785)
.LoadContentFrom("InvoiceLineItemEditor", "Invoice", new { LineItemId = "Initial" })
.Draggable()
.Resizable()
.Visible(false)
)
我需要能够重新加载该部分视图,并在运行时传递不同的数据。就我在文档中阅读的内容而言,我应该能够做到:
$("#wndInvoiceLineEditor").data("kendoWindow").refresh({
data: {
LineItemId: $($(".k-state-selected td")[0]).text()
}
});
但是,操作服务器端:
public ActionResult InvoiceLineItemEditor(string LineItemId)
{
int id = 0;
if(string.IsNullOrEmpty(LineItemId) || !int.TryParse(LineItemId, out id))
{
return PartialView("InvoiceLineItemEditorPartial", new InvoiceLineItem());
}
...blah blah blah
…没有收到正确的ID(从表中获取它的jquery确实有效,已经通过Chrome控制台进行了测试)
相反,它接收视图中配置的数据:“初始”
我错过什么了吗?如何将数据发送回操作,以便使用正确的信息加载该部分
答复:
问题是在LoadContentFrom视图中窗口初始化的一部分中设置了默认数据。将其更改为:
@(Html.Kendo().Window()
.Name("wndInvoiceLineEditor")
.Title("Invoice Line Item Editor")
.Content("loading dialog...")
.Height(350)
.Width(785)
.LoadContentFrom("InvoiceLineItemEditor", "Invoice")
.Draggable()
.Resizable()
.Visible(false)
)
@(Html.Kendo().Window()
.Name("wndInvoiceLineEditor")
.Title("Invoice Line Item Editor")
.Content("loading dialog...")
.Height(350)
.Width(785)
.LoadContentFrom("InvoiceLineItemEditor", "Invoice")
.Draggable()
.Resizable()
.Visible(false)
)
…解决了问题。窗口被设置为默认值,似乎是不可更改的。问题在于LoadContentFrom视图中窗口初始化的一部分设置了默认数据。将其更改为:
@(Html.Kendo().Window()
.Name("wndInvoiceLineEditor")
.Title("Invoice Line Item Editor")
.Content("loading dialog...")
.Height(350)
.Width(785)
.LoadContentFrom("InvoiceLineItemEditor", "Invoice")
.Draggable()
.Resizable()
.Visible(false)
)
@(Html.Kendo().Window()
.Name("wndInvoiceLineEditor")
.Title("Invoice Line Item Editor")
.Content("loading dialog...")
.Height(350)
.Width(785)
.LoadContentFrom("InvoiceLineItemEditor", "Invoice")
.Draggable()
.Resizable()
.Visible(false)
)
…解决了问题。窗口被设置为默认值,似乎是不可更改的。请将您的解决方案作为问题的公认答案来编写,否则无法立即看出此问题是否有解决方案。