我可以将Html表数据发送到控制器 [英] Can I Send Html Table Data To Controller

查看:97
本文介绍了我可以将Html表数据发送到控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从剃刀视图向控制器发送表格数据吗?如果是,如何?

can i send table data to controller from razor view? if yes how?

推荐答案

预计您需要从剃刀视图将参数值传递给动作方法,

Anticipating that you need to pass parameter values to an action method from razor view,
@Html.ActionLink("Submit", "Submit", new { id =  Model.ID, name = Model.Name}, 
new {id = "lnkSubmit" }) 
//First new is the parameters, second one is the unique id used for jqeury                  purposes





可能是您要在提交时发送表单数据值。您需要通过以下脚本传递ajax调用:



May be you want to send form data values on submit. You need to pass through ajax calls from script like below:


.ajax({
type:POST ,
url:/ Home / SubmitForm,
data:
.ajax({ type:"POST", url:"/Home/SubmitForm", data:


(#formValuesSubmit)。serialize(),
success:function( ){
//你想成功的任何东西......
}
});
("#formValuesSubmit").serialize(), success: function(){ //anything you want on success... } });



希望这对你有所帮助。 />
我已经预料到并回答了你的问题。如果您有其他想法,请发表评论。

谢谢。

:)


Hope this helps you.
I have anticipated and answered your question. If you had something else in mind, please comment.
Thanks.
:)


这篇关于我可以将Html表数据发送到控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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