你好,大家好我希望你們所有人都做得很大,所以我工作的一個項目,我的朋友,但我們都是中級程序員並堅持到一個地方,所以我需要你的幫助......MVC查詢碼
的問題是我被困在一個特定的代碼是「搜索的菜」:
After selecting value from a combo box
它在做什麼後從Java腳本方法回來,你可以在圖片中看到,但我認爲我的代碼不完整,因爲本身我不能從數據庫中,我是顯示我的「勾住ShowAll頁」,但在列表值當我選擇從組合框中的值不會顯示任何東西..
的ActionResult代碼
public ActionResult ShowAll()
{
var a = from tb in me.RecipeTables select tb;
return View(a.ToList());
}
[HttpPost]
public ActionResult ShowAll(string searchDish)
{
var k = me.RecipeTables.Where(l => l.recipeName == searchDish);
return View(k);
}
查看代碼機智Java腳本函數
<html>
<script type="text/javascript">
function SelectedIndexChanged()
{
this.myForm.submit();
}
</script>
<%using (Html.BeginForm("ShowAll", "RecipeView", FormMethod.Post, new { id = "myForm", name = "myForm", enctype="multipart/form-data"}))
%>
<p>
<%: Html.ActionLink("Create New", "Create") %>
<select id="searchDish" name="searchDish" onchange="SelectedIndexChanged()">
<option value="0">Select any</option>
<option value="1">biryani</option>
<option value="2">fried rice</option>
<option value="3">Nihari</option>
<option value="4">Tikka</option>
</select>
</p>
需要幫助!在此先感謝
沒了它沒有工作看看我的代碼,然後查看我創建此列表的頁面 – faseeh