html - How to know which checkboxes are checked? -
I'm having trouble checking which checkboxes in my MVC project, here my check box is setup :
& lt; Div id = 'myCheckboxDiv' & gt; & Lt; Input type = "checkbox" onclick = "checkel (this)" & gt; Check all @forich (@model.deatable object.aaFormGroupDocuments @ var form) {& lt; Br> Var checkboxId = "chk" + form.DocumentId; @html Checkbox (checkbox, new {value = form.DocumentId, @checked = true}); @ Form.DocumentName; } & Lt; / Div & gt;
Basically I load a page that will display a checkbox with each DoaFormGroupDocument with DetailObject (can be anywhere from 0-10). What I would like to do, when I click on the save button at the bottom of the page, the IDs related to each checkbox (each one unique) are saved in a list.
To be clear, I really do not have to do anything specifically on this page, I need a stored ID in a list which I can use in other areas (pages) I think this means that I need the checkbox status to be set in the controller.
You can read data sent from request
in your work method and Check
if it is checked or not (check sent as checkbox
value)
var list = new listing & Lt; Bool & gt; (); Foreign currency (different types in extended objects. DoaFormGroupDocuments) {var checkBoxId = "chk" + form.DocumentId; If (request [checkbox] == "current") list. Add (true); And list. Add (wrong); }
List is your checkbox
position. Avoid as you like.
Comments
Post a Comment