2016-07-07 2 views
0

나는 2 개의 체크 박스 질문을 가지고있다. C#을 사용하여 사용자가 선택한 값을 얻는 방법을 알고 싶습니까?체크 박스, 사용자가 선택한 값을 얻으려면

<div class="form-group"> 
     <label for="checkboxes" id="checkbox123" style="text-align:left;color:black">2) How much of the training can you recall?</label> 
     <div> 
      <label class="checkbox-inline" for="checkboxes-0"> 
       <input type="checkbox" name="checkboxes" id="checkboxes-03" value="1"> 
       All of it 
      </label> 
      <label class="checkbox-inline" for="checkboxes-4"> 
       <input type="checkbox" name="checkboxes" id="checkboxes-43" value="5"> 
       Not at all 
      </label> 
     </div> 
    </div> 

    <div class="form-group"> 
     <label for="checkboxes" id="checkbox456" style="text-align:left;color:black">2) Are you ok?</label> 
     <div> 
      <label class="checkbox-inline" for="checkboxes-0"> 
       <input type="checkbox" name="checkboxes" id="checkboxes-03" value="1"> 
       Yes 
      </label> 
      <label class="checkbox-inline" for="checkboxes-4"> 
       <input type="checkbox" name="checkboxes" id="checkboxes-43" value="5"> 
       No 
      </label> 
     </div> 
    </div> 

위의 코드는 내 체크 박스 code.please 가이드입니다. 감사합니다.

답변

0

코드에 ASP.net 컨트롤이 없습니다. 모든 컨트롤은 클라이언트 측이므로 코드 숨김에 액세스 할 필요가 없습니다.

bool checked = cbAllofit.Checked; 
: 당신의 .cs의 요소에 액세스하려면 당신이 당신의 .cs에서

<label class="checkbox-inline" for="checkboxes-0"> 
     <input type="checkbox" name="checkboxes" id="checkboxes-03" value="1"> 
      All of it 
</label> 

<asp:CheckBox ID="cbAllofit" runat="server" Text="All of it" Checked="true" CssClass="checkbox-inline"/> 

및 액세스 교체 runat="server"

설정해야합니다 파일

관련 문제