vendredi 15 mars 2019

How to get hold of the submitted checkboxes in ASP.NET Core

I am using razor pages and this is what I am trying to accomplish

The user have list of rows, each row have a checkbox, the user select any number of checkboxes and click the button "approve selected". then my OnPostApproveSelectedAsync method should trigger and process only the selected rows. (code below is simplified)

<form method="post" style="padding-top:30px">
<button id="as" asp-page-handler="ApproveSelected" class="btn btn-default" type="submit">
                        <span class="fa fa-check"></span>Approve selected
                    </button>

<input name="approval" id="1" type="checkbox" />
<input name="approval" id="2" type="checkbox" />
</form>

in my razorpage model I have the following code that I can see gets triggered when I click the button but I don't know how to get access to the ids of the selected checkboxes

public async Task<IActionResult> OnPostApproveSelectedAsync() {

}




Aucun commentaire:

Enregistrer un commentaire