I have an MVC Index page that reflects a table in the DB.
One of the columns is a boolean.
I want to have a checkbox right in the index page, that when clicked, immediately calls an action that will save the new status on the spot without having to submit/refresh.
I have an MVC Index page that reflects a table in the DB. One
Share
You should add an
onclickevent to theinput. Your razor would look similar to:Then your script would look similar to (assuming you have access to jQuery; converting it should be straight forward enough):
Notice the parameter name:
newValue.And finally your Action to handle the request:
Notice the parameter name:
newValue.