2017-11-24 3 views
0

확인란이있는 면도기가 있습니다. true/false로 확인란을 미리 채울 수 없습니다. 여기 내 코드는면도기가 데이터를 미리 채울 수 없습니다.

<label for="HousingBidsComps_99">&nbsp;</label> 
<div class="check_box_group"> 
    <input type="checkbox" id="HousingBidsComps_99" name="HousingBidsComps[1].IsChargesIncluded" class="customCheckbox" > 
    <label for="HousingBidsComps_99" style="margin-bottom:0"> 
     <span style="margin-bottom:0"> 
      @Html.LabelFor(model => model.HousingBidsComps[1].IsChargesIncluded, new { @class = "padd-left-0" }) 
     </span> 
    </label> 
</div> 
+0

사용'@ Html.CheckBoxFor (m => m.HousingBidsComps [1] .IsChargesIncluded)'- 항상 사용 은'HtmlHelper' 방법은 모델 –

+0

에 바인딩 그리고 당신은이'

답변

2

당신이처럼 체크 박스를 결합하는 시도해야합니다 :

<label for="HousingBidsComps_99">&nbsp;</label> 
<div class="check_box_group"> 

    @Html.CheckBoxFor(m => m.HousingBidsComps[1].IsChargesIncluded, new { @class="customCheckbox" }) 

    <label for="HousingBidsComps_99" style="margin-bottom:0"> 
     <span style="margin-bottom:0"> 
      @Html.LabelFor(model => model.HousingBidsComps[1].IsChargesIncluded, new { @class = "padd-left-0" }) 
     </span> 
    </label> 
</div> 
+0

당신은에'checked' 속성을 설정하지 마십시오'올바른 생성됩니다 'CheckBoxFor()'메소드! (속성 값이'false'인데도 체크 박스가 항상 체크되게하는 것은 다행히도 무시됩니다) –

관련 문제