나는 MVC : 라우팅 경로 값이 이상하게 작동합니까?
public class BusinessUnitDetail
{
public Guid Id { get; set; }
public string Name { get; set; }
public LicensesDetails LicensesDetails { get; set; }
public RepresentativeDetails RepresentativeDetails { get; set; }
}
public class LicensesDetails
{
public string BusinessUnitName { get; set; }
public List<LicensesVM> Licenses { get; set; }
}
public class RepresentativeDetails
{
public string BusinessUnitName { get; set; }
public List<RepresentativeVM> Representatives { get; set; }
}
가 현재 내보기는 대표의
목록 및 라이센스의
목록을 보여줍니다 두 개의 테이블을 포함처럼 보이는 뷰 모델 있습니다. 여기 꽤 긴하지만 난 라이센스 테이블 일부 행의 세부 조치를 클릭하면 어쨌든 @{
ViewBag.Title = "BusinessUnitDetails";
Layout = "~/Views/shared/_BootstrapLayout.basic.cshtml";
int snor = 1;
int snol = 1;
}
<fieldset>
<legend>@Model.Name <small>Representatives</small></legend>
</fieldset>
<table class="table table-striped table-hover table-bordered">
<caption></caption>
<thead>
<tr>
<th>S.No</th>
<th>Name</th>
</tr>
</thead>
@foreach (var entry in Model.RepresentativeDetails.Representatives)
{
<tr>
@*@Html.HiddenFor(m=>entry.BusinessUnitId)*@
<td>@(snor++)</td>
<td>@entry.UserName</td>
<td>
<div class="btn-group" >
<a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#">
Action<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Details", "RepresentativeDetails",routeValues:new{entry.BusinessUnitId})</li>
</ul>
</div>
</td>
</tr>
}
</table>
<fieldset>
<legend>@Model.Name <small>Licenses</small></legend>
</fieldset>
<table class="table table-striped table-hover table-bordered">
<caption></caption>
<thead>
<tr>
<th>S.No</th>
<th>Kind</th>
</tr>
</thead>
@foreach (var entry in Model.LicensesDetails.Licenses)
{
<tr>
@* @Html.HiddenFor(m=>entry.BusinessUnitId)*@
<td>@(snol++)</td>
<td>@entry.LicenseName</td>
<td>
<div class="btn-group" >
<a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#">
Action<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Details", "LicenseDetails",routeValues:new{entry.BusinessUnitId})</li>
</ul>
</div>
</td>
</tr>
}
</table>
, 나는 Html.ActionLink
에 명시된 바와 같이 LicenseDetails
액션 메소드에 나를 리디렉션을 예상 보기이다 ,하지만 그렇지 않습니다. 내가 세부 작업을 클릭 경로 내가 LicenseDetails은? BusinessUnitId = 부분이 생성되는 방법을 모르는 Customer/businessunit/LicenseDetails?BusinessUnitId=25c70a1d-0ed5-406f-8cae-1c6c1bf7d0da
이며, 작업이 컨트롤러에서 LicenseDetails 방법에 전달하지 않는 이유. 두 번째 테이블에서 details 작업을 클릭하면 적절한 컨트롤러 조치로 전달됩니다. 적절한 GUID ID 어떤 생각입니까?
편집 1 : 라이센스 상세 액션 메도
public ActionResult LicenseDetails(Guid licenseId)
{
var licenseDetails = _businessUnitRepository.GetLicenseDetail(licenseId);
return View(licenseDetails);
}
BusinessUnitId 란 무엇인가요? 나는 그것을위한 재산을 보지 못했다. – Dismissile
그 guid, 경로에서 볼 수있는 guid 값은 보유하고있는 값입니다 – Cybercop
'LicenseDetails' 액션 메소드 서명을 보여줄 수 있습니까? – Daniele