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

[Solved] Conditional toolbar visibility?

1 Answer 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joan Vilariño
Top achievements
Rank 2
Joan Vilariño asked on 20 Sep 2010, 04:02 PM
Hi..

I need to make the "Insert new" button and the toolbar visible only when some condition occurs (like the user having permission to add new records).

I'm already doing this with the Edit and Delete buttons this way...

columns.Command(commands =>
    {
      commands.Edit();
      commands.Delete();
    })
  .Visible(Principal.GetGeneric().IsInFunctionality(Functionality.TheFunctionality))
  .Width(180).Title("Acciones");

... but I can't find a "Visible" builder for toolbar or for the Insert button... any hint on how doing this ?

Cheers!!

1 Answer, 1 is accepted

Sort by
0
Joan Vilariño
Top achievements
Rank 2
answered on 20 Sep 2010, 04:14 PM
My fault!! I should search the forums first XD

It's easy:

.ToolBar(tb => { if (whateverCondition) tb.Insert(); })

Thanks anyway and sorry for the post
Tags
Grid
Asked by
Joan Vilariño
Top achievements
Rank 2
Answers by
Joan Vilariño
Top achievements
Rank 2
Share this question
or