【发布时间】:2015-09-13 17:48:42
【问题描述】:
我有输入框,我需要从中获取值,以便稍后将它们重定向到特定控制器,但我不知道如何访问这些值。有人可以指导我如何获取这些值吗?
<form action="@Url.Action("AddSpecific", "Comment", new { AuthorT ="1", WebSiteT = "1", postIdT = 1, TextT = "1",TitleT = "1" })" method="post">
<h1>
<label for="Title">Title</label>
<input name="Title" id="Title" type="text" required />
</h1>
<h1>
<label for="Text">Text</label>
<input name="Text" id="Text" type="text" required />
</h1>
<h1>
<label for="AuthorSite">AuthorSite</label>
<input name="AuthorSite" id="AuthorSite" required />
</h1>
<h1>
<label for="Author">Author</label>
<input name="Author" id="Author" type="text" required />
</h1>
<h1>a
<label for="IdOfPost">IdOfPost</label>
<input name="IdOfPost" id="IdOfPost" type="number" required />
</h1>
<input type="submit" value="Post comment" />
【问题讨论】:
-
您是要获取 javascript 还是 c# 中的值?
-
c# 实际上,如果你能在 java 脚本中找到解决方案,我会非常高兴
-
语法和可读性。
-
您需要访问 MVC 站点并完成基本教程。特别是,如何使用模型,如何使用 html 帮助器在视图中呈现该模型,以及如何定义控制器方法以便在提交表单时绑定模型。
标签: c# jquery html asp.net-mvc asp.net-mvc-3