Пример модели
public class MyModel
{
public bool ShowCommentsSection { get; set; }
}
Действия контроллера
public ActionResult Index()
{
var myModel = new MyModel();
//Note: ShowCommentsSection (and the bool type) is false by default.
return View(myModel);
}
public ActionResult Review()
{
var myModel = new MyModel
{
ShowCommentsSection = true
};
//Note that we are telling the view engine to return the Index view
return View("Index", myModel);
}
Просмотр (где-то внутри вашего index.aspx, вероятно)
<% if(Model.ShowCommentsSection) { %>
<% Html.RenderPartial("Reviews/ReviewPartial", Model); %>
<% } %>
Или, если Бритва - ваша чашка чая:
@if(Model.ShowCommentsSection) {
Html.RenderPartial("Reviews/ReviewPartial", Model);
}