我有一个非常简单的代码:
@using (Ajax.BeginForm("SearchAccount", "Account", new AjaxOptions { UpdateTargetId = "SearchResults", HttpMethod = "Get", InsertionMode = InsertionMode.Replace }))
{
<fieldset>
<input id="txtSearchBox" name="SearchString" type="text" />
</fieldset>
<input type="submit" value="Search" />
}
在控制器方面我有以下代码
public PartialViewResult SearchAccount(FormCollection formCollection)
{
try
{
string SearchString = formCollection["SearchString"];
List<Moovers.DAL.Account> Accounts = Moovers.BL.Account.SearchAccount(SearchString);
return PartialView("_AccountSearchResult", Accounts);
}
catch (Exception ex)
{
throw;
}
}
问题是“FormCollection”,它是空的。可能的原因是什么?