0
我有我的ajax搜索問題。當我向模型中添加一些數據時,我會轉到我的索引視圖,在那裏使用我的ajax搜索。然後我從輸入和提交表格中刪除文本,索引視圖沒有顯示添加的數據。如何解決這個問題 ??空輸入沒有返回附加值
這是我SearchController
public ActionResult Index(string searhcString)
{
var competitions = from s in db.Competitions
select s;
if(!String.IsNullOrEmpty(searhcString))
{
competitions =competitions.Where(s => s.CompName.ToUpper().Contains(searhcString.ToUpper())
|| s.CompName.ToUpper().Contains(searhcString.ToUpper()));
}
return View(competitions);
}
索引視圖
@using (Ajax.BeginForm("AjaxSearch", "Competitions",
new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "ajaxTable"
}))
{
<input type="text" name="q" />
<button type="submit"><img height="10" src="@Url.Content("~/Images/findBtn.png")" /></button>
}
ow,我找到解決辦法,我只是改變**'AjaxOption HttpMetod從GET到POST ** –