我正在尝试根据kendo网格中的用户权限有条件地返回枚举值,如果用户具有权限,则仅显示show show else,我试图在c#中执行此操作,而我被困在需要的特定语法上if语句,是c#的新功能。
<div class="left width100 margin-top10">
@(Html.Kendo().Grid<AddressBook>()
.Name("grid")
.HtmlAttributes(new { @class = "left width100 kendo-grid" })
.Columns(columns => {
columns.Bound(p=>p.AddressBookType).EditorTemplateName("AddressBookTypeEditor").ClientTemplate("#= data.AddressBookTypeText #")});
public enum {
Call,
Email
}
//permission and variable
ViewBag.OmniEmailFeatureAccess = auth.UserHasPermission( PermissionType.AccessOmniEmail);
var AddressBookType = new List<AddressBookType>();
if (!ViewBag)
return AddressBookType(0);