public ActionResult Edit(int id)
{
//Do stuff for edit
//put model in ViewData
ViewData["Model"]=model;
ViewData["GenericPartial"]="~/Views/Employee/Edit/EditPartial1.ascx"
return View("Generic");
}
}
public ActionResult Detail(int id)
{
//Do stuff for edit
//put model in ViewData
ViewData["Model"]=model;
ViewData["GenericPartial"]="~/Views/Employee/Detail/DetailPartial1.ascx"
return View("Generic");
}
}
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
Marked as answer by ricka6 on May 21, 2010 03:22 PM
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: Cleaning up my views - moving aspx/templates to other folders?
May 19, 2010 05:51 PM|LINK
You cannot do this because of the default View engine.Howevere there is awork around.
Create a simple view (say Generic.aspx),
<html>
<% Html.RenderPartial(ViewData["GenericPartial"].ToString(),ViewData["Model"]); %>
</html>
and return always Generic View
public ActionResult Edit(int id)
{
//Do stuff for edit
//put model in ViewData
ViewData["Model"]=model;
ViewData["GenericPartial"]="~/Views/Employee/Edit/EditPartial1.ascx"
return View("Generic");
}
}
public ActionResult Detail(int id)
{
//Do stuff for edit
//put model in ViewData
ViewData["Model"]=model;
ViewData["GenericPartial"]="~/Views/Employee/Detail/DetailPartial1.ascx"
return View("Generic");
}
}
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD