0
저는 MVC를 처음 사용하고있어서 도움이되고 싶습니다.동일한 뷰에서 동일한 부분 뷰를 여러 번 실행
제품을 서로 나란히 표시하는보기 (아래)가 있습니다. 여기까지 모든 것이 좋습니다. 라인에서
@foreach (var item in Model)
{
<a href="@Url.Action("showProductDetails", "Shared", new { ProductID = item.ProductID }, null)">
<div class='OutsideDiv' >
<table class='DivBorder'>
<tr >
<td class='title'>
@item.ProductName
</td>
</tr>
<tr >
<td class='imageBox'>
<img alt='' src="@item.ImageURL" />
</td>
</tr>
<tr>
<td class='title'>
@Html.Action("showAverageRating", "Rating" , new { ProductID = item.ProductID } ) *************
</td>
</tr>
<tr>
<td class='desc'>
@item.Description
</td>
</tr>
<tr>
<td class='price'>
€ @item.Price
</td>
</tr>
</table>
</div>
<script type='text/javascript'> $('.DivBorder').mouseover(function() { $(this).css('border-color', '#0953cb'); $(this).css('background-color', '#eaeaea'); }); $('.DivBorder').mouseout(function() { $(this).css('border-color', '#bdbdbd'); $(this).css('background-color', '#f6f6f6'); });</script>
</a>
}
이 표시 '****'지금 바로 선택 처음 3 시작과 함께 5 등급 별을 표시하고 또 다른보기 (showAverageRating)를 호출하고 위.
<input class="star " name="adv1" type="radio" />
<input class="star " name="adv1" type="radio" />
<input checked="checked" class="star " name="adv1" type="radio" />
<input class="star " name="adv1" type="radio" />
<input class="star " name="adv1" type="radio" />
문제 별점 다시 호출 (부분도 이상) 볼 번째 항목에서 개 이하, 다음 제 제품의 등급으로 영상을 표시한다는 것이다.
은 내가 다른 사람보다는 Html.Action
것을 사용한다고 생각?
편집 : showAverageRating 코드
public ActionResult showAverageRating(int ProductID)
{
decimal averageRating = new RatingsService.RatingsClient().getAverageRating(ProductID);
ViewData["averageRating"] = averageRating;
return PartialView();
}
당신이 showAverageRating 조치 코드를 게시 할 수있는 부분보기를 showAverageRating –
공공 ActionResult showAverageRating (INT의 제품 ID) { 진수 averageRating = 새로운 RatingsService.RatingsClient() getAverageRating (제품 ID).; ViewData [ "averageRating"] = 평균 등급; return PartialView(); } – drinu16
메인 포스트의 편집 확인, 위의 코멘트보다 – drinu16