当前位置: 动力学知识库 > 问答 > 编程问答 >

asp.net mvc - 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 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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: