Hey,
Let's say that I have a ListView with comments:
@(Html.Kendo().ListView<Adelante_ERP_GSBK.Models.ProjectComment>()
.Name("listView")
.TagName("div")
.ClientTemplateId("template")
.HtmlAttributes(new {style = "border: none;"})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetComments", "ProjectComment", new {projectId = Model.Id}))
))
Template
<script type="text/x-kendo-tmpl" id="template">
<div class="post">
<div class="user-block" style="margin-bottom: 0;">
<span class="username" style="display: inline; margin-left: 10px;">
#:User.Name#
</span>
<span class="description" style="display: inline; margin-left: 5px">
#:kendo.toString(CommentDate, "d")#
</span>
<a onclick="showInPopup('@Url.Action("AddOrEdit", "ProjectComment", null, Context.Request.Scheme)/#:Id#', 'Edit')" style="cursor: pointer;" title="Dodaj">
<i class="fa-solid fa-pen-to-square"></i>
</a>
<a onclick="showInPopup('@Url.Action("Delete", "ProjectComment", null, Context.Request.Scheme)/#:Id#', 'Delete?')" style="cursor: pointer;" title="Usuń">
<i class="fa-solid fa-xmark"></i>
</a>
</div>
<div style="margin-left: 10px;">
#:CommentContent#
</div>
</div>
</script>
Everything works fine, but I don't want that all users always see edit/delete buttons.
Edit button should be visible only for author and administrator, delete only for administrator.
Does anyone have an idea how can I do this?