jeudi 30 avril 2020

How could i add an on click event to this checkbox? (HTML Helpers)

I have a checkbox as follows:

@using (Html.BeginForm("ItemsEdit", "Items", FormMethod.Post))
       {

            @Html.CheckBox("itemCheck")

       }

I want to be able to send an additional value to a controller when it is clicked, similar to something like this:

<input id = "@dataLineItem.Split(Model.ItemList.delimiterChar)[0]" type="checkbox" value="true" name="Remember" onclick="sendCheckId(this.id)" />

However, if i were to use the method above, i wouldnt know how to pass the 'true/false' values of the checkbox, to the same controller.




Aucun commentaire:

Enregistrer un commentaire