开发者

allowing to update gridview depending on user authentication asp.net

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 oth开发者_JAVA百科er users will only be able to view.

how do customize the gridview so that only a specific user has the option to update?


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>";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜