开发者

View is not rendering correctly in ASP.NET MVC 3

I have moved a view from folder to Shared folder. When I try to navigate from controller to the shared view it is navigating to the default开发者_Python百科 view and not the shared view. I checked in Global.asax, I created new route in the Global.asax, but it is still pointing to the default route and loading the default view.

Could anyone help me in resolving this issue?


Make sure the old view is deleted, otherwise it will always pick that one over the shared folder.


if you have not explicitly defined the name of the view e.g lets suppose you have an ActionResult in Home controller

public ActionResult Index()
{
return View();
}

the view by the name of Index.aspx and/or Index.ascx is searched first in the Home folder which is present in the Views folder if a matching veiw is found there it is not searched further. If it is not found then it will be searched in the Shared folder

make sure you have deleted the view form the Default location

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜