0
我嘗試了一些東西。我爲我的英語提前道歉。是不是我想要PartialViewResult的方式
我的動作代碼;
public PartialViewResult showProduct()
{
var query = db.Categories.Where((c) => c.CategoryID == 4);
return PartialView("_EditCategory",query);
}
我的視圖代碼:
@using (Ajax.BeginForm(
"showProduct",
new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.InsertAfter,
UpdateTargetId = "result"
}))
{
<input type="submit" value="Get" />
}
<div id="result">
</div>
當我按下提交按鈕(這值獲得)返回結果,但在像http://localhost:57616/Home/showProduct另一個頁面,但我想回導致索引頁格。
任何人都可以幫助我嗎?
我不想用javascript :( –
請參閱我在答案底部添加的註釋。 – itsmatt