# Multiple checkbox binding

**URL:** <https://forum.radzen.com/t/multiple-checkbox-binding/2209>\
**Category:** Blazor Server\
**Created:** [December 15, 2019, 1:42am UTC](https://forum.radzen.com/t/multiple-checkbox-binding/2209 "2019-12-15T01:42:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chebyr](https://forum.radzen.com/letter_avatar_proxy/v4/letter/c/71c47a/32.png) [@chebyr](https://forum.radzen.com/u/chebyr)\
**Post date:** [December 15, 2019, 1:42am UTC](https://forum.radzen.com/t/multiple-checkbox-binding/2209/1 "2019-12-15T01:42:06Z")

</div>

How do I make checked only checkbox I clicked and not checking all checkboxes?

@foreach (var principle in Principles)  
{

```
                        var principleId = @principle.PrincipleId;

                    <tr>

                        <td>@principle.Description</td>
                        <td><RadzenCheckBox id="@principle.PrincipleId" TValue="bool" bind-Value="CheckboxValue" Change="@(args => ChangePrincipleCheckbox(args,principleId))" /></td> 
                        

                    </tr>
                    }

```

@code {  
void ChangePrincipleCheckbox(bool value, int principleId)  
{

```
    CheckboxValue = value;

```

}  
}

---

<div class="post-metadata">

**Author:** ![chebyr](https://forum.radzen.com/letter_avatar_proxy/v4/letter/c/71c47a/32.png) [@chebyr](https://forum.radzen.com/u/chebyr)\
**Post date:** [December 15, 2019, 4:48pm UTC](https://forum.radzen.com/t/multiple-checkbox-binding/2209/2 "2019-12-15T16:48:41Z")

</div>

maybe this is simpler question. Why without change function I see checkbox changing but with change function checkbox visually is not changing. Maybe a bug?

@RadzenCheckBox id="@principle.PrincipleId" TValue="bool" Value="false" /\> - works I see visually checkbox changes

@RadzenCheckBox id="@principle.PrincipleId" TValue="bool" Value="false" Change="@(args =\> ChangePrincipleCheckbox(args,principleId))" /\> - i do not see visual checkbox change

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [December 16, 2019, 8:57am UTC](https://forum.radzen.com/t/multiple-checkbox-binding/2209/3 "2019-12-16T08:57:57Z")

</div>

Hi @chebyr,

What does the ChangePrincipleCheckbox method do? If it somehow causes StateHasChanged you are hitting [this Blazor bug/limitation](https://github.com/aspnet/AspNetCore/issues/17034). You will need to use @bind-Value as well.

---

<div class="post-metadata">

**Author:** ![chebyr](https://forum.radzen.com/letter_avatar_proxy/v4/letter/c/71c47a/32.png) [@chebyr](https://forum.radzen.com/u/chebyr)\
**Post date:** [December 16, 2019, 7:37pm UTC](https://forum.radzen.com/t/multiple-checkbox-binding/2209/4 "2019-12-16T19:37:50Z")

</div>

Hi if I i have 16 checkboxes generated by for loop then binding will check/uncheck all 16 checkboxes and I need to check /uncheck then one I clicked. I guess because bind-Value="CheckboxValue" applies to all of them. Is there a way to bind to specific checkbox I am working with?

The method does some logic but nothing with ui .

Thank you,

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [December 16, 2019, 7:43pm UTC](https://forum.radzen.com/t/multiple-checkbox-binding/2209/5 "2019-12-16T19:43:34Z")

</div>

In this case you could try with an array of equal size:

`@bind-Value="CheckboxValue[i]"`

---

<div class="post-metadata">

**Author:** ![chebyr](https://forum.radzen.com/letter_avatar_proxy/v4/letter/c/71c47a/32.png) [@chebyr](https://forum.radzen.com/u/chebyr)\
**Post date:** [December 16, 2019, 8:17pm UTC](https://forum.radzen.com/t/multiple-checkbox-binding/2209/6 "2019-12-16T20:17:08Z")

</div>

Brilliant that worked! thank you a bunch

---

<div class="post-metadata">

**Author:** ![Kuljeet\_Kaur](https://forum.radzen.com/user_avatar/forum.radzen.com/kuljeet_kaur/32/6430_2.png) [@Kuljeet\_Kaur](https://forum.radzen.com/u/Kuljeet_Kaur)\
**Post date:** [March 31, 2021, 11:58am UTC](https://forum.radzen.com/t/multiple-checkbox-binding/2209/7 "2021-03-31T11:58:20Z")

</div>

Hey can you please tell me how to edit multiple checkbox values  
for create i use

 ![Capture](https://forum.radzen.com/uploads/default/original/2X/b/b3f853aa3a4277c2d1c92ef7d2d2e60fc5278130.png) this code  
but when i use it for edit System.NullReferenceException: 'Object reference not set to an instance of an object.' CrudWith Radzen.ViewModel.Product ViewModel.Features List.get returned null.this type of error was shown

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [March 31, 2021, 12:35pm UTC](https://forum.radzen.com/t/multiple-checkbox-binding/2209/8 "2021-03-31T12:35:15Z")

</div>

Hey @Kuljeet_Kaur,

You can check what’s null when you debug your application with Visual Studio.
