如何在按钮单击视图之间传递文本框值(MVC) [英] How to pass textbox value on button click from view to action(MVC)
本文介绍了如何在按钮单击视图之间传递文本框值(MVC)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个文本框,我用JS显示当前日期。我在下面有一个按钮。现在我想将按钮单击上的当前日期传递给控制器操作方法。我怎么能这样做?
解决方案
看看这个: http://www.c-sharpcorner.com/UploadFile/3d39b4/getting-data-from-view-to-controller-in-mvc/ [ ^ ]
查看链接
它会帮助你..
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8& VED = 0CB8QFjAA&安培; URL = HTTP%3A %2F%2Fstackoverflow.com%2Fquestions%2F12954806%2Fhow到传递-A-文本框 - 值从视点到一个控制器功能于MVC-4和; EI = ZtZeVcTRE5CMuATo4oKgBw&安培; USG = AFQjCNFGqPjCzdpm4T01InSd52pe3JLXTg [ ^ ]
您可以在按钮上单击调用jquery ajax function
< input type =submitvalue =Submitonclick =Send()>< / input>
function Send(){
var url =/ YourController / YourActionResult;
I have one text box where i have shown current date with JS. I have a button below. Now i want to pass the current date on the button click to the controller action method. How could i do that?
解决方案
Check this out: http://www.c-sharpcorner.com/UploadFile/3d39b4/getting-data-from-view-to-controller-in-mvc/[^]
check out the link
it will helps you ..
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB8QFjAA&url=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F12954806%2Fhow-to-pass-a-textbox-value-from-view-to-a-controller-in-mvc-4&ei=ZtZeVcTRE5CMuATo4oKgBw&usg=AFQjCNFGqPjCzdpm4T01InSd52pe3JLXTg[^]
You can do this on button click call jquery ajax function
<input type="submit" value="Submit" onclick="Send()"></input>
function Send() { var url = "/YourController/YourActionResult";
这篇关于如何在按钮单击视图之间传递文本框值(MVC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文