Kendo ui 如何使用剑道网格和剑道文本框将结果返回到局部视图
我在将剑道网格和字段的值返回到视图时遇到问题 早些时候,我的局部视图中只有剑道网格,因此我使用以下代码返回网格的值:Kendo ui 如何使用剑道网格和剑道文本框将结果返回到局部视图,kendo-ui,kendo-grid,partial-views,asp.net-mvc-partialview,kendo-ui-mvc,Kendo Ui,Kendo Grid,Partial Views,Asp.net Mvc Partialview,Kendo Ui Mvc,我在将剑道网格和字段的值返回到视图时遇到问题 早些时候,我的局部视图中只有剑道网格,因此我使用以下代码返回网格的值: public virtual ActionResult GetValues(long Id1, [DataSourceRequest]DataSourceRequest request) { return Json(ViewModel.List<Another_View_Model>.ToDataSourceResult(request)); } 谁能告诉我哪
public virtual ActionResult GetValues(long Id1, [DataSourceRequest]DataSourceRequest request)
{
return Json(ViewModel.List<Another_View_Model>.ToDataSourceResult(request));
}
谁能告诉我哪里做错了,或者有没有更好的方法在同一个模型中同时返回网格和剑道元素的结果
我的观点结构如下:
@model ViewModel
@(Html.Kendo().TextBoxFor(p => p.textboxField)
.Name("TextBox")
)
@(Html.Kendo().Grid<Another_View_Model>()
.Name("KendoGrid")
@model视图模型
@(Html.Kendo().TextBoxFor(p=>p.textboxField)
.Name(“文本框”)
)
@(Html.Kendo().Grid())
.名称(“肯多格里德”)
非常感谢您的帮助。请提前感谢!!使用
TextBoxFor(p=>p.PropertyName)
或TextBox().Name(“PropertyName”)
不要同时使用两者。name属性将覆盖TextBoxFor。因此,在您的示例中,您的剑道Textbox实际上绑定到名为Textbox
的属性,而不是您所期望的textboxField
反之亦然,如果您发布表单,模型的
textboxField
将为空,而如果您有一个名为TextBox
的字符串参数,它将被文本框的值填充我认为使用“ActionResult”而不是“PartialView”尝试“View”
ViewModel
{
public long Id { get; set; }
public List<Another_View_Model> Another_View_Model { get; set; }
public string textboxField { get; set; }
}
public virtual PartialViewResult GetValues(long Id1)
{
return PartialView("_PartialView", ViewModel);
}
@model ViewModel
@(Html.Kendo().TextBoxFor(p => p.textboxField)
.Name("TextBox")
)
@(Html.Kendo().Grid<Another_View_Model>()
.Name("KendoGrid")