Reputation: 60711
i have a web app in asp.net running on windows authentication
i want only a specific user to be able to update, while the other users will only be able to view.
how do customize the gridview so that only a specific user has the option to update?
Upvotes: 1
Views: 614
Reputation: 46047
After the GridView is bound, try adding this code somewhere:
CommandField editButton = GridView.Columns.OfType<CommandField>().ElementAtOrDefault(0);
if (editButton != null)
editButton.Visible = HttpContext.Current.user.Identity.Name == "<USER NAME>";
Upvotes: 1