C# 如何将文本框中的文本发送到actionResult?
我有一个关于MVC4(剃须刀)的问题。我有一个要筛选数据的页面。有一个文本框(输入)和一个提交按钮。我想将文本框中的文本移动到actionresult。我如何解决这个问题 在我的页面上,我有以下行:C# 如何将文本框中的文本发送到actionResult?,c#,asp.net-mvc,asp.net-mvc-4,razor,C#,Asp.net Mvc,Asp.net Mvc 4,Razor,我有一个关于MVC4(剃须刀)的问题。我有一个要筛选数据的页面。有一个文本框(输入)和一个提交按钮。我想将文本框中的文本移动到actionresult。我如何解决这个问题 在我的页面上,我有以下行: @{ using (Html.BeginForm("Experiences")) { <span class="label">Filter on:</span><input id="FilterText" type="text" size="50"/&
@{ using (Html.BeginForm("Experiences"))
{
<span class="label">Filter on:</span><input id="FilterText" type="text" size="50"/>
<input type="submit" value="Submit" name="knowledge" /><br />
}
}
<br />
指定与操作方法参数名称相同的输入元素的
名称
属性值
<input id="FilterText" name="knowledge " type="text" size="50"/>
<input type="submit" value="Submit" name="submitKnowledge" />
或
<input id="FilterText" name="knowledge " type="text" size="50"/>
<input type="submit" value="Submit" name="submitKnowledge" />
@using(Html.Beginform("Knowledge","YourControllerName"))
{
//form elements
}
@using(Html.Beginform())
{
//form elements
}