I have a Telerik MVC grid.
1 of the columns needs to be hidden from certain users.
This is easy to achieve using .Visible
The problem is, when I launch the Edit mode for the row, the column I want hidden is displayed in the edit view.
Any idea how to hide the column from both the grid view and the edit view?
Edit: I'm using Pop Up edit mode and Ajax binding.
Hiding a column from the edit form depends on the edit mode. You have not specified which edit mode you are using so I will give a solution for every single one:
Inline and InCell - you just need to make the column Readonly()
and it will no longer be editable.
Popup or InForm - those modes use Html.EditorForModel
which displays all properties of the model by design. As a result even the properties which are not bound as columns will be shown. Hiding something from the edit form must be done with JavaScript via the OnEdit event. However the OnEdit event is raised only during Ajax binding. It is not clear from your description whether you are using ajax or server binding. If you use server binding you have to hook to the OnLoad JavaScript event and hide the unnecessary column from the editor using jQuery.