This is a migrated thread and some comments may be shown as answers.

How to Hide Toolbar button based on a Condition?

2 Answers 1818 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Akhilesh
Top achievements
Rank 1
Akhilesh asked on 13 Mar 2013, 11:44 PM

I have created a single page application with Kendo Grid.  and users have different roles. I need to Hide and show buttons on  User Role Type.

2 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 14 Mar 2013, 03:34 PM
Hello Akhilesh,


This is a quote from my answer in the support thread:


You could use a boolean in the Grid initialization to indicate whether the buttons should be shown or not.
E.g.

.ToolBar(toolbar => {
    if (userCanEdit)
    {
        toolbar.Create();
        toolbar.Save();
    }
})



 

Kind regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Mittal
Top achievements
Rank 1
commented on 14 Mar 2022, 10:28 PM

How can i achieve this in vb.net?

I am trying to do this. but getting  Compiler Error Message: BC33104: 'If' operator requires either two or three operands.
  Html.Kendo().Grid(Of MyData)() _
                  .Name("Grid") _
                  .Editable(Function(e) e.Mode(GridEditMode.InLine)) _
                  .ToolBar(Function(t) If ViewBag.FullControl Then t.Create() End If) _
Yanislav
Telerik team
commented on 16 Mar 2022, 04:40 PM

This error is thrown due to a syntax error. I recommend you to try to do it this way : 

                .ToolBar(Function(t)
                             If ViewBag.Controll = True Then
                                 t.Create()
                             End If
                         End Function) _

 

0
Chrys
Top achievements
Rank 1
answered on 15 Aug 2013, 05:58 PM
Feel so dumb that I didn't try this.
Tags
Grid
Asked by
Akhilesh
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Chrys
Top achievements
Rank 1
Share this question
or