I need a Partial View control to be displayed according to a condition. For some views a button would appear for others not and this would be set via a parameter in the Partial View call.
After searching I saw that I can use ViewDataDictionary
, but when trying to implement I did not succeed.
For the control to be displayed in View the call would be as follows:
@Html.Partial("_smart_actions", item, new ViewDataDictionary {{ "MenuClone", true }})
For the control to be displayed in View the call would look like this:
@Html.Partial("_smart_actions", item)
Partial View :
<a href="@Url.Action("Details", new { id = Model.Id })" class="link-mutted" title="Visualizar">
<span class="glyphicon glyphicon-share" aria-hidden="true"></span>
</a>
|
<a href="@Url.Action("Edit", new { id = Model.Id })" class="link-mutted" title="Editar">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
</a>
|
<a href="@Url.Action("Delete", new { id = Model.Id })" class="link-mutted" title="Excluir">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
</a>
@if (ViewDataDictionary == true)
{
<a href="@Url.Action("DuplicarDados")" class="link-mutted" title="Duplicar">
<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span>
</a>
}
It just does not seem to control, how to get around this problem?