Hello All,
I am using c#.net
I have a repeater and a ObjectDataSource (ObjectDataSource is created within the code behind).
Within the repeater are two buttons (edit/delete). I need to system to either hide/remove these buttons if the user doesn’t have permissions to edit/delete.
Repeater Code
<ItemTemplate>
<tr class="tRow left">
<td>
<asp:Button ID="editClick" OnCommand="EditClick" runat="server" Text="Edit" />
<asp:Button ID="deleteClick" OnCommand="DeleteClick" runat="server" Text="Delete/Cancel" />
</td>
<td><%#Eval("bookingID")%></td>
</tr>
</ItemTemplate>
I thought I could add an if statement to the repeater however the userRepository is a class and I dont want to be accessing a class within my source code. Is there another way of doing it?
<ItemTemplate>
<tr class="tRow left">
<td>
<%if (!userRepository.GetPermission("xxxxx"))
{%>
<asp:Button ID="editClick" OnCommand="EditClick" runat="server" Text="Edit" />
<asp:Button ID="deleteClick" OnCommand="DeleteClick" runat="server" Text="Delete/Cancel" />
<%}%>
</td>
<td><%#Eval("bookingID")%></td>
Thanks in advance for any help.
Clare