1. 단일 체크박스
html |
<input type="checkbox" class="form-check-input" name="check_box_name" value="true" /> |
cs |
public async Task<IActionResult> Edit(Models.Sample model, bool check_box_name) { if (true == check_box_name) { // 처리 } } |
2. 여러 체크박스를 한번에 받기
html |
<input type = "checkbox" class="form-check-input" name="check_box_name" value="1" /> <input type = "checkbox" class="form-check-input" name="check_box_name" value="2" /> <input type = "checkbox" class="form-check-input" name="check_box_name" value="3" /> |
cs |
public async Task Edit(Models.Sample model, int[] check_box_name) { if (true == check_box_name) { // 처리 } } |
int[], string[]로 받을 수 있다.