aghaux
aghaux

Reputation: 749

Telerik mvc grid with Edit mode true or false

Which approach would be good to manage whether the grid should be .Editable. Where can i control if .Editable should be true or false based on something that happens server side?

I want to do this because i don´t want to be able to edit a grid if i have a field in for example DB that tells me that "editdata = false" and therefor i cannot alter this data in the grid.

Upvotes: 0

Views: 569

Answers (1)

TJ Gokken
TJ Gokken

Reputation: 91

The easiest way I can think of is to set a ViewBag.GridEditMode or something like that in your controller.

So, for example if the grid needs to be editable, in your controller;

ViewBag.GridEditMode = true;

Then, in your view set the grid Mode like,

.Editable((bool)ViewBag.GridEditMode)

Hope this helps.

Upvotes: 2

Related Questions