...I want to Show the 'delete' button when user is an admin, and show the 'add item' button when user is a contributor:
<!-- More code above -->
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton CSSClass="TableRightLink" ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
Visible=<%# User.IsInRole(@"DOMAIN\CMDB_ADMIN") %>
Text="Delete"
OnClientClick="return confirm('Are you certain you want to delete this item?');"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<SelectedRowStyle VerticalAlign="Top" />
<HeaderStyle ForeColor="White" CssClass="TableHeader" BackColor="SteelBlue" />
</asp:GridView>
<asp:table width="100%" runat="server" CSSclass="PromptTable" Visible=<%# User.IsInRole(@"DOMAIN\CMDB_CONTRIBUTE") %> >
<asp:tablerow><asp:tablecell HorizontalAlign=Center>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="AddConfigItem.aspx" ForeColor="LightCyan">Add Item</asp:HyperLink>
</asp:tablecell></asp:tablerow></asp:table>
The Delete button 'visible' attribute works fine. But, the "add item' hyperlink doesn't. It always shows. View-source tells me that %# User.IsInRole(@"DOMAIN\CMDB_CONTRIBUTE") %> isn't evaluating to anything. Any idea why this is?