asp.net mvc - Display Custom Command Button Kendo UI Grid in MVC with Conditional Authorization Role -
asp.net mvc - Display Custom Command Button Kendo UI Grid in MVC with Conditional Authorization Role -
kendo ui grid in mvc conditional au custom command button how conditionally display destroy or custom command button base of operations on authorization
i wanna display custom command in kendo mvc grid users have role="admin" like
@if (httpcontext.current.user.identity.isauthenticated) { if (httpcontext.current.user.isinrole("admin")) {
in kendo grid
@(html.kendogrid<management.models.users.usermodel>("dgvuser", "partialcustomusermodel", false) .columns(c => c.command(cc => { cc.custom("delete").htmlattributes(new { @style = @" color : transparent; background-position: center center; background-image: url('../content/themes/base/images/blue/imgedituser.png'); background-size: contain; background-repeat: no-repeat; height: 28px; cursor: pointer;" }).click("deleteuser");
what can do?
you can utilize following
@(html.kendo() .grid<yourmodel>() .name("grid") .columns(columns => { columns.command(command => { if (user.isinrole("admin")) { command.custom("delete").click("deleteuser"); } }).title("commands"); }))
or easily, instead of adding custom button, add together destroy button
hope help you
asp.net-mvc authorization conditional kendo-grid add-custom-command
Comments
Post a Comment