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

[Solved] Has anybody been able to apply security to different fields in the Grid?

1 Answer 61 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.
Max
Top achievements
Rank 1
Max asked on 15 Feb 2012, 04:56 PM
Hi all,

I was wondering if anyone has a good link/article/blog regarding using the Telerik Grid to control who has access to specific fields.
I am aware of the attribute [Authorize] (Users,Roles) that you apply into an action but I am trying to find out how you can take one step further and be more granular regarding applying security to each field inside a row.

Thank you

1 Answer, 1 is accepted

Sort by
0
Dadv
Top achievements
Rank 1
answered on 17 Feb 2012, 10:48 AM
hi,

Did you try something like : columns.Bound(m => m.CustomerId).Visible([your security logic]) ?

Or if you just want this field to be read only by role : columns.Bound(m => m.CustomerId).ReadOnly([your security logic]) 

You security logic could be a ViewBag property for example.

An other way if you want to control the security by the model, it's to define a custom UIHint that look if the current property have a [Authorize] attribute and define the use of Html.EditorFor() or Html.DisplayFor () or something else.
But i don't think this will work in Ajax mode.

Regards,
Tags
Grid
Asked by
Max
Top achievements
Rank 1
Answers by
Dadv
Top achievements
Rank 1
Share this question
or