i created a kendo Tabstrip in a kendo popup window as it's shown here:
@model NeoPaie.ViewModels.GrilleSalaireVM
@using Kendo.Mvc.UI;
@using NeoPaie.ViewModels;
<div class="popupError"></div>
@(Html.Kendo().TabStrip()
.HtmlAttributes(new { style = "width:430px;height:400px" })
.Name("tabstrip")
.SelectedIndex(0)
.Items(items =>
{
items.Add()
.Text("Grille De Salaire")
.Content(@Html.Partial("Gestion De La Grille").ToHtmlString());
items.Add()
.Text("Fiche Administartive")
**.LoadContentFrom("Liste", "GrilleRubriqueFixe");**
})
)
在第二个选项卡中,我想显示一个GrilleRubriqueFixe****list:一个带有粗略方法的剑道网格:但是发生了这个异常:The model item passed into the dictionary is of type 'System.String', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable
1[NeoPaie.ViewModels.GrilleSalaireVM]'` 在第二个中无法使用另一个模型标签??我该如何解决这个问题?
`
有我的GrilleRubriqueFixe 列表:`
@model IEnumerable<NeoPaie.ViewModels.GrilleRubriqueFixeVM>
@using Kendo.Mvc.UI;
@{
ViewBag.Title = "Rubrique Fixes";
}
@section headerView {
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<link href="@Url.Content("~/Content/Edit.css")" rel="stylesheet" />
<script type="text/javascript" src="~/Scripts/Common/Edit.js"></script>
}
<h2>Rubrique Fixes</h2>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.HtmlAttributes(new { style = "width:500px;height:300px" })
.Editable(editing =>
{
editing.Mode(GridEditMode.InCell).TemplateName("PopupEditors/PopupGrilleRubriqueFixe")
.Window(w => w.Title("NeoPaie : Ajouter/Modifier une RubriqueFixe").Width(400).Height(350));
editing.DisplayDeleteConfirmation("Êtes-vous sûr de vouloir supprimer RubriqueFixe?");
})
.ToolBar(commands =>
{
commands.Create().Text("Ajouter").HtmlAttributes(new { style = "width:100px;float:right" });
})
.DataSource(dataSource => dataSource
.Ajax()
.Read("Read", "GrilleRubriqueFixe")
.Create("Save","GrilleRubriqueFixe")
.Update("Save", "GrilleRubriqueFixe")
.Destroy("Delete", "GrilleRubriqueFixe")
.Model(model => model.Id(p => p.Grille_Rubrique_FixeId))
.Events(e => e.RequestEnd("OnKendoGridSaveEnd").Error("OnKendoGridPopupListSaveError"))
)
.Columns(columns =>
{
columns.Bound(p => p.Grille_Rubrique_FixeId).Groupable(false).Hidden();
columns.Bound(p => p.CODE).Width(50).Title("Rubrique");
columns.Bound(p => p.VALEUR).Width(100).Title("Valeur");
columns.Bound(p => p.LIBELLE).Width(300).Hidden();
columns.Bound(p => p.RubriqueId).Width(100).Hidden();
columns.Bound(p => p.GrilleId).Width(100).Hidden();
columns.Command(command => command.Destroy().Text(" ")).Width(60).Title("Supprimer").HtmlAttributes(new { style = "text-align:center" });
columns.Command(command => command.Edit().Text(" ")).Width(60).Title("Modifier").HtmlAttributes(new { style = "text-align:center" });
})
.Scrollable()
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Single)
.Type(GridSelectionType.Row))
.Navigatable()
)
and my GrilleRubriqueFixe Controller:
公共 ActionResult Liste( ) { 尝试 {
List<GrilleRubriqueFixeVM> lstVM = ServiceApplicatif.GetListe().OrderBy(x => x.RubriqueId).ToList();
// Drop Down List des listRubrique
IEnumerable<RubriqueVM> listRubrique = RefDataManager.GetRefData<RubriqueVM>() as IEnumerable<RubriqueVM>;
ViewData["CodeRubrique"] = new SelectList(listRubrique, "RubriqueId", "CODELIBELLE");
return PartialView(lstVM);
}
catch (Exception ex)
{
LoggerGrilleRubriqueFixe.Error(string.Format("Exception : {0}", ex.Message.ToString()));
throw new Exception("Erreur lors du chargement.");
}
}
[HttpPost]
public JsonResult Read([DataSourceRequest] DataSourceRequest dsRequest)
{ try { // 下拉列表 des listRubrique
IEnumerable<RubriqueVM> listRubrique = RefDataManager.GetRefData<RubriqueVM>() as IEnumerable<RubriqueVM>;
if (listRubrique.Any())
{
ViewBag.idrub = listRubrique.First().RubriqueId;
}
ViewData["Rubrique"] = new SelectList(listRubrique, "RubriqueId", "CODELIBELLE");
List<GrilleRubriqueFixeVM> lstVM = ServiceApplicatif.GetListe().OrderBy(x => x.GrilleId).ToList();
return Json(lstVM.ToDataSourceResult(dsRequest));
}
catch (Exception ex)
{
LoggerGrilleRubriqueFixe.Error(string.Format("Exception : {0}", ex.Message.ToString()));
throw new Exception("Erreur lors du chargement.");
}
} `