1
筆者認爲:如何爲「搜索」功能做一個自動提交?
@using (Html.BeginForm())
{
<p id="a">
Search par VCMEMBRE/VCPARENT: @Html.TextBox("SearchString")
<input type="submit" name="searchType" value="Find!" />
</p>
}
我的控制器:
public ActionResult Index(string searchString)
{
if (!String.IsNullOrEmpty(searchString))
{
axeModel.trcubezonequotas = db.TRCUBEZONEQUOTAS.Where(
(s =>
s.VCMEMBRE.ToLower().Contains(searchString.ToLower())
|| s.VCPARENT.ToLower().Contains(searchString.ToLower())
)
);
return View(axeModel);
}