问题描述:

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 dont 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.

网友答案:

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.

相关阅读:
Top