0
뷰백의 값을 표시하려고 할 때 예외가 발생합니다. Linq를 사용하여 두 테이블을 조인하고 뷰백에 해당 데이터를 저장했습니다.'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' '개체'에 'intEmployeeId'에 대한 정의가 없습니다.
이것은이 어떤 도움을 이해할 수있을 것이다
@model IEnumerable<EMPApp.Models.trnEsSeparationDetail>
@{
ViewBag.Title = "HRSeparationDetails";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>HRSeparationDetails</h2>
<div>
@if (ViewBag.SeparationList == null)
{
<div style="color:green"><h3>@ViewBag.SeparationerrorMessage</h3></div>
}
else
{
<table class="grid" cellpadding="0" cellspacing="0">
<tr>
<th>
<b>Employee Id</b>
</th>
@*<th>
<b>ReasonForSeparationId</b>
</th>*@
<th>
<b>Reason For Separation</b>
</th>
<th>
<b>Resignation Date</b>
</th>
<th>
<b>Relieving Date</b>
</th>
<th>
<b>Separation Remarks</b>
</th>
</tr>
@foreach (var item in ViewBag.SeparationList)
{
<tr>
<td>
@item.intEmployeeId
@*@{
Session["SeparationEmpId"] = item.intEmpId;
}
@Html.ActionLink(Session["SeparationEmpId"].ToString(), "EmployeeDashboard", "HRAdmin", new { id = @item.intEmpId }, null)*@
</td>
@*<td>
@item.ReasonForSeperationId
</td>*@
<td>
@item.ReasonForSeparation
</td>
<td>
@item.ResiganationDate
</td>
<td>
@item.RelievingDate
</td>
<td>
@item.SeparationRemarks
</td>
</tr>
}
</table>
}
내 viewpage 내 컨트롤러 액션 메소드
public ActionResult HRSeparationDetails()
{
//List<trnEsSeparationDetail> separationlist = (from list in db.trnEsSeparationDetails
// select list).ToList();
ViewBag.SeparationList = (from list in db.trnEsSeparationDetails
join R in db.mstEsEmpReasonForSeparations
on list.ReasonForSeperationId equals R.intSeperationId
select new
{
intEmployeeId = list.intEmpId,
ReasonForSeparation = R.txtReasonForSeperation,
ResiganationDate = list.dtResignationDate,
RelievingDate = list.dtRequestedRelievingDate,
SeparationRemarks = list.txtRemark
}).ToList();
return View();
}
입니다. 감사합니다 ...
고마워요 선생님이
을 표시 할 속성 및 컨트롤러
및 뷰의 뷰 모델을 만드는 것입니다 .. 그 잘 작동한다. .. – user3273883
나는 당신이 그것을 받아 들일 것이다라고 생각한다. 12 가지 질문을하고 3 가지 다른 일에 유의하면서도 하나의 질문을 받아들이지 않았습니다. 별로 좋지 않은 형태! –
@StephenMuecke 올바른 선생님, 저는이 유형의 사용자를 돕지 말아야한다고 생각합니다. – Roshan