asp.net-mvc-3 – 将输入值传递给Action(ASP.Net MVC 3)
发布时间:2020-05-28 01:08:02 所属栏目:asp.Net 来源:互联网
导读:我在View中有代码: @using (Html.BeginForm(MyAction, MyController){ input type=text id=txt / input type=image src=/button_save.gif alt=
|
我在View中有代码: @using (Html.BeginForm("MyAction","MyController")
{
<input type="text" id="txt" />
<input type="image" src="/button_save.gif" alt="" />
}
我如何将txt的值传递给我的控制器: [HttpPost]
public ActionResult MyAction(string text)
{
//TODO something with text and return value...
}
解决方法给你的输入一个名字,并确保它符合动作的参数。<input type="text" id="txt" name="txt" /> [HttpPost] public ActionResult MyAction(string txt) (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 线程被中止
- asp.net-mvc-3 – SignalR依赖注入问题
- asp.net-mvc – 使用城堡温莎的实体框架
- asp.net-mvc – Html.TextBoxFor在POST操作中不显示更新的值
- asp.net – 如何增加我的存储过程调用的超时时间(见错误)?
- webservice的两种调用方式
- asp.net – 与SQL Server建立连接时出现网络相关或实例特定
- 如何在ASP.NET MVC中获得HttpResponse的引用?
- asp.net-mvc – ASP.NET MVC – 如何从不同的控制器维护Mod
- asp.net-mvc-3 – 在ASP.NET MVC3 Intranet应用程序中获取登
推荐文章
站长推荐
热点阅读
