Hi,
I need to check if a column exists or not.
I have a global method that hides the edit/delete buttons on a row but now I have a grid without the edit button.
I tried this but getting error on the if statements: Cannot find a cell bound to column name 'EditCommandColumn'
I need to check if a column exists or not.
I have a global method that hides the edit/delete buttons on a row but now I have a grid without the edit button.
I tried this but getting error on the if statements: Cannot find a cell bound to column name 'EditCommandColumn'
| public static void HideRadGridEditButtonsForReaders(GridItemEventArgs e) |
| { |
| if (e.Item is GridDataItem) |
| { |
| GridDataItem item = (GridDataItem)e.Item; |
| ImageButton editButton = null; |
| ImageButton deleteButton = null; |
| if(item["EditCommandColumn"] != null) |
| editButton = (ImageButton)item["EditCommandColumn"].Controls[0]; |
| if (item["DeleteColumn"] != null) |
| deleteButton = (ImageButton)item["DeleteColumn"].Controls[0]; |
| if (HttpContext.Current.User.IsInRole(Utilities.RoleTypes.AdministratorReaders.ToString())) |
| { |
| if(editButton != null) editButton.Visible = false; |
| if (deleteButton != null) deleteButton.Visible = false; |
| } |
| } |
| } |