问题
My partialView is Opened in the modal dialog form, User select special row, I want to Submit the parent form with special value as a parameter.
My parent form is:
<form id="mainForm" action="<%= Request.RawUrl %>" method="post" enctype="multipart/form-data">
and my submit button in the modal dialog (and in the GridView) that post data to action is:
<button name="selectVehicle" id="<%= item.id %>" value="selection" type="button" onclick="$('#mainForm').submit()">
OK
</button>
this is work correctly and all my data Post to the Action, but how can i send special Value to the action using this submit button?
回答1:
Add a hidden field, and update the value in the onclick handler.
来源:https://stackoverflow.com/questions/1700446/asp-net-mvc-send-parameter-to-action-with-submit-button-in-the-partialview