4
我有一個真正顯示「http:// localhost:3579/MusicStore/StoreManager/Index」的地址「http:// localhost:3579/MusicStore/StoreManager」。在ASP.net中的二級視圖MVC
我想從索引到「http:// localhost:3579/MusicStore/StoreManager/Edit」指向同一級別的另一個地址。編輯是StoreManager文件夾內的視圖,因此是第二級視圖。
我很困惑我甚至會將該方法放入哪個控制器中。我嘗試在MusicStoreController中放置「public ActionResult Edit」,但它未被識別。我怎樣才能做到這一點?
好的答案。但是現在它找不到索引視圖。它正在查看「〜/ Views/StoreManager/Index.cshtml」。這是因爲我將「StoreManager」指定爲默認控制器。但是,我希望它在「MusicStore/StoreManager」內尋找視圖。 – Andrew 2011-06-01 20:49:06
@Andrew - 您可以在Index操作中指定索引文件正確位置的路徑。在方法的'return View()'部分指定正確的路徑,例如'return View(「〜/ Areas/Admin/Views/MusicStore/StoreManager/Index.cshtml」)' – amurra 2011-06-01 20:54:21
我希望能減少手動操作。儘管如此,這是有效的。謝謝。 – Andrew 2011-06-01 20:59:37