---
title: "How to get checkbox value in Asp.net mvc?`"  
description: "How to get checkbox value in Asp.net mvc?`"  
author: "Anonymous User"  
published: 2015-04-14  
updated: 2015-04-14  
canonical: https://www.mindstick.com/forum/23094/how-to-get-checkbox-value-in-asp-dot-net-mvc  
category: "asp.net mvc"  
tags: ["mvc", "mvc4"]  
reading_time: 1 minute  

---

# How to get checkbox value in Asp.net mvc?`

I'm creating a table.I want to get selected [checkbox](https://www.mindstick.com/articles/291/how-should-use-checkbox-control-in-vb-dot-net) [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages).

```
<tr>  <td>    @item    <input type="hidden" value="@item" name="@item"class="chkbx" id="ControllerName" />  </td>  <td>                        <input type="checkbox" id="Iscreate" value="@Create"class="chkbx" />  </td>  <td>    <input type="checkbox" id="IsDelete" value="@Delete" class="chkbx" />  </td>  <td>    <input type="checkbox" id="IsView" value="@View" class="chkbx" />  </td>  <td>    <input type="checkbox" id="IsEdit" value="@Edit" class="chkbx" />  </td>  <td>    <input type="checkbox" id="IsDownload" value="@Download" class="chkbx" />  </td></tr>Jquery code I use<script type="text/javascript"> 
$('input[type=checkbox]').change(function () {    var vales =$("#ControllerName").val();    var vals =$('input[class=chkbx]:checked').map(function () {      return $(this).val();   
}).get().join(',');   
$('#debug').val(vals);  });</script>
```

Basically this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) create a Value in [hidden](https://www.mindstick.com/forum/2303/skip-validating-field-from-hidden-div) [Field](https://www.mindstick.com/forum/160867/does-mindstick-provide-training-for-field-marketing) Like this

3-Create-[Account](https://www.mindstick.com/articles/33699/how-tech-is-disrupting-the-accounting-world),3-[Delete](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax)-Account,3-[View](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view)-Account,3-Edit-Account,3-[Download](https://www.mindstick.com/articles/188403/website-to-download-photos-from-instagram)-Account

But Actually i need this

3-Account-Create-Delete-Edit-Download-view,4-Account-Create-Delete-Edit-Download-view, 5-Account-Create-Delete-Edit-Download-view

## Replies

### Reply by Anonymous User

Make a view model with your wanted properties:

```
public class YouViewModelName(){    public bool IsView {get; set;}    public bool IsDeleted{get; set;}    public bool IsCreated{get; set;}    public bool IsEdited{get; set;}    ......... and so on}
```

Then use this view model in your view:

```
@Html.CheckBoxFor(x => x.IsView)@Html.CheckBoxFor(x => x.IsDeleted)@Html.CheckBoxFor(x => x.IsCreated)@Html.CheckBoxFor(x => x.IsEdited)
```

and so on...

When you post that view to your post action, you will get the values.

```
[HttpPost]public ActionResult PostActionName(ViewModelName viewModel){ //use values here}
```


---

Original Source: https://www.mindstick.com/forum/23094/how-to-get-checkbox-value-in-asp-dot-net-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
