Hi, When I try to show a row only to the role "Administrator" I do :
When I try to put administrator + supervisor, it doesn't work:
<asp:TemplateField>
<ItemTemplate>
<asp:Button name="btnSelect" CommandName="Select" Text="Choisir" runat="server" Visible='<%# User.IsInRole("Administrator")%>' />
</ItemTemplate>
</asp:TemplateField>
How can I do to show the role only to the role "Administrator" and "Supervisor" and "Chef" ?
salim20001
Member
154 Points
507 Posts
Hiding on a gridView
May 02, 2012 08:21 AM|LINK
Hi, When I try to show a row only to the role "Administrator" I do :
When I try to put administrator + supervisor, it doesn't work: <asp:TemplateField> <ItemTemplate> <asp:Button name="btnSelect" CommandName="Select" Text="Choisir" runat="server" Visible='<%# User.IsInRole("Administrator")%>' /> </ItemTemplate> </asp:TemplateField>How can I do to show the role only to the role "Administrator" and "Supervisor" and "Chef" ?
tusharrs
Contributor
3230 Points
668 Posts
Re: Hiding on a gridView
May 02, 2012 08:26 AM|LINK
Visible='<%# Convert.ToBoolean(User.IsInRole("Administrator")) ||
Convert.ToBoolean(User.IsInRole("Supervisor")) ||
Convert.ToBoolean(User.IsInRole("Chef")) %>'
( Mark as Answer if it helps you out )
View my Blog
salim20001
Member
154 Points
507 Posts
Re: Hiding on a gridView
May 02, 2012 09:06 AM|LINK
Thanks, but why should I convert to Boolean ?
tusharrs
Contributor
3230 Points
668 Posts
Re: Hiding on a gridView
May 02, 2012 10:08 AM|LINK
no need use directly
( Mark as Answer if it helps you out )
View my Blog
salim20001
Member
154 Points
507 Posts
Re: Hiding on a gridView
May 02, 2012 10:37 AM|LINK
Visible='<%# (User.IsInRole("Administrator")) || (User.IsInRole("Supervisor")) || (User.IsInRole("Chef")) %>'