Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将文本框中的文本发送到actionResult?_C#_Asp.net Mvc_Asp.net Mvc 4_Razor - Fatal编程技术网

C# 如何将文本框中的文本发送到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"/&

我有一个关于MVC4(剃须刀)的问题。我有一个要筛选数据的页面。有一个文本框(输入)和一个提交按钮。我想将文本框中的文本移动到actionresult。我如何解决这个问题

在我的页面上,我有以下行:

@{ 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
}