0
.NET MVC 2.0問題之間傳遞數據:尋呼.NET MVC中的數據,並且需要不同的看法
主要的問題是我想在尋呼ArrayList中我的數據,並將其顯示在瀏覽不同的網頁。 (我想在客戶端分頁數據,因爲在我的服務器端,數據源存儲在哈希表中,我無法在數據庫中進行分頁) 這裏是一個稱爲「搜索」的視圖,用戶可以輸入關鍵字並點擊「提交」按鈕提交表單到行動:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult SearchKey(FormCollection forms)
{
//Deal with the searching keywords and return the new result list
ViewData["result"]=result_list;
return View("Search",Model);
//I can not use return RedirectToAction("Search",new{id=page_num})
//which can not return the ViewData
}
public ActionResult Search()
{
ArrayList result_list = new ArrayList();
ViewData["result"]=result_list;
//I will also need to pass a Model to the view
return View(Model);
}
當我認爲我的結果,網址爲:/控制器/ SearchKey
所以到這裏,一切都很好,我能得到正確的搜索結果,但我想分頁的結果。然後我需要傳遞頁面的視圖,但URL:/控制器/ SearchKey/page_num不驗證,如果我鍵入/控制器/搜索/ page_num,有空結果(結果從「 SearchKey「動作)
所以我的問題是,對於這種情況,如果我想做客戶端分頁,我該怎麼辦? 謝謝
沒有理由再使用'ArrayList'。考慮使用它的強類型表弟['列表'](http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx)。 –
vcsjones