Das Problem besteht darin, dass die Daten der Teilansicht nicht im Dialogfeld angezeigt werden, ich sehe nur den Titel. Es scheint, dass ich auch ein Problem mit dem Controller-Aufruf habe. Bitte beachten Sie, dass ich die dynamische Modellerstellung verwendet habe, da das Modell dynamisch im Controller erstellt wurde, kein vorhandenes Modell, und ich weiß nicht, wie man diesen Modelltyp verwendet. Vielen Dank für jede Hilfe,
Das sind meine Codes:
Das ist die Schaltfläche in der Rasiermesseransicht:
Diese jQuery-Codes:
Code: Select all
$(document).ready(function () {
$("#GetEmp").click(function (event) {
$("#popup").dialog({
width: 200,
hight: 400,
title: 'please select an employee',
modal: true,
open: function (event, ui) {
$(this).load("@Url.Action("Travel", "GetEmployee")");
}
});
});
});
Code: Select all
public class Employee
{
public string EmpName;
public string EmpPhone;
public string EmpNum;
}
[HttpPost]
public ActionResult GetEmployee()
{
List Emp = new List
{
new Employee { EmpName= "ScottGu", EmpPhone = "23232323", EmpNum="242342"},
new Employee { EmpName = "Scott Hanselman", EmpPhone = "3435353", EmpNum="34535"},
new Employee { EmpName = "Jon Galloway", EmpPhone = "4534535345345",
EmpNum="345353"}
};
return PartialView("_EmpPartial", Emp );
}
Code: Select all
@model dynamic
[list]
@foreach (var emp in Model) {
[*]
@emp.EmpName
}
[/list]
aber es wird nicht mit einer roten Unterstreichung kompiliert. Muss ich @model in meiner Teilansicht dynamisch halten?
Mobile version