2014-06-17 9 views
0
@{ 
      foreach (CaseCount cc in @Model.CaseCounts) 
      { 
       <tr> 
        <td>@cc.Country</td> 
        <td>@string.Format("{0:n0}", cc.RegisteredCases)</td> 
        <td>@Html.DropDownList("Reports", new SelectList(@Model.ReportList, "Value", "Text"), new { onchange = "window.location.href='Reports/RenderReport/' + this.value + '/' + @cc.Country;" })</td> 
       </tr> 
      } 
     } 

@ cc. 국가가 인식되지 않습니다. 컨트롤러의 동작이 트리거되지 않습니다 :(면도기 onchange가 @variable을 인식하지 못함

내가 cc.Country @ 제거하거나 단순히 하드 코딩 넣어 경우가

+0

당신이 렌더링 된 HTML을 게시하시기 바랍니다 수 – rhughes

답변

2

작동 문제는 당신이 내부 텍스트로의 @ cc.Country를 가하고 있다는 점이다 . 인용이 시도 :

<td>@Html.DropDownList("Reports", new SelectList(@Model.ReportList, "Value", "Text"), new { onchange = "window.location.href='Reports/RenderReport/' + this.value + '/'" + cc.Country + ";" })</td> 
+1

이 제외 도움 최종 올바른 라인이다 : ( @ Html.DropDownList "보고서", 새로운 selectList의 (Model.ReportList @ " 값}, "텍스트"), 새 {onchange = "window.location.href = '보고서/RenderReport /'+ this.value + '/"+ @ cc.Country + "';"}) –

관련 문제