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