1
我目前正在使用的ASP.net頁面有一個下拉列表,旨在有一個過濾器列表。當用戶選擇過濾器時,我想顯示一個具有適合過濾器屬性的用戶控件。動態選擇一個Asp.Net MVC用戶控件
這裏是有問題的控制器動作:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(FormCollection collection)
{
var filterType = Request.Form["FilterSelect"];
ViewData["FilterChosen"] = filterType;
PopulateSelectionFiltersData();//This method fills up the drop down list
//Here is where I would like to switch based on the filterType variable
return View();
}
過濾器類型變量具有正確的價值,但我不確定要怎麼做下一部分。
此外,作爲一個必然的問題,在調用之間保持所選下拉值的最佳方式是什麼?
非常感謝,
KevDog
需要改變的RenderPartial消除等號,並在末尾添加一個分號。否則,這是完美的。 – KevDog 2009-04-29 14:23:55