Asp.net MVC使用partialView中的“提交"按钮将参数发送至动作 [英] Asp.net mvc send parameter to action with submit button in the partialView

查看:60
本文介绍了Asp.net MVC使用partialView中的“提交"按钮将参数发送至动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的partialView在模式对话框窗体中打开,用户选择特殊行,我想提交带有特殊值作为参数的父窗体.

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.

我的父母表格是:

<form id="mainForm" action="<%= Request.RawUrl %>" method="post" enctype="multipart/form-data">

模态对话框(以及GridView中)中用于将数据发布到操作的我的提交按钮是:

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?

推荐答案

添加一个隐藏字段,并更新onclick处理程序中的值.

Add a hidden field, and update the value in the onclick handler.

这篇关于Asp.net MVC使用partialView中的“提交"按钮将参数发送至动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆