如何通过 Kendo Window 刷新选项传递模型?
在我的部分视图中,我使用下面的代码:-
var proWindow = $("#productWindow").data("kendoWindow");
proWindow.refresh({
url: "../../Product/UpdateProduct",
type: "POST",
contentType:"application/json",
data: { prodModel: $("form").serialize()
});
以下是控制器的代码:-
[HttpPost]
public ActionResult UpdateProduct(ProductMaintViewModel prodModel)
{
}
但是我在控制器中的模型参数上得到了空值。
任何人都可以对此有任何想法,这意味着我们如何在 jquery/javascript 中使用剑道窗口刷新数据选项发布整个模型?
仅供参考,我正在开发 ASP.NET MVC 4 应用程序。
下面是我的 ProductMaintViewModel 类:-
public class ProductMaintViewModel
{
[HiddenInput(DisplayValue = false)]
public int ProductID { get; set; }
public int? CustomerId { get; set; }
public int? InsuranceId { get; set; }
[Required]
[StringLength(50)]
[Remote("CheckProductName", "Product", ErrorMessage = "Product Name already exists.")]
[Display(Name = "Name")]
public string Name { get; set; }
[StringLength(100)]
[Display(Name = "Description")]
public string Description { get; set; }
public bool IsDraft { get; set; }
[Required]
[Display(Name = "Product Type")]
public int? SelectedProductTypeID { get; set; }
public IEnumerable<SelectListItem> ProductTypes { get; set; }
public bool IsDeleted { get; set; }
[Display(Name = "Customer Type")]
public int? SelectedCustomerSubTypeId { get; set; }
public IEnumerable<SelectListItem> CustomerSubTypes { get; set; }
public IEnumerable<SelectListItem> AvailableLabor { get; set; }
}