c# - Hide Repeater columns based on user privileges -
can explain me how hide repeater column based on user privileges.
say have:
<asp:repeater id="repeater" runat="server> <headertemplate> <table id="table_id"> <tr> <th>name</th> <th>secret info</th> <tr> </headertemplate> <itemtemplate> <tr> <td><asp:label id="label1" runat="server" text='<%# eval("name") %>' /></td> <td><asp:label id="label1" runat="server" text='<%# eval("secretinfo") %>' /></td> <tr> <itemtemplate> <alternatingitemtemplate> <tr> <td><asp:label id="label1" runat="server" text='<%# eval("name") %>' /></td> <td><asp:label id="label1" runat="server" text='<%# eval("secretinfo") %>' /></td> <tr> <alternatingitemtemplate> <footertemplate> </table> </footertemplate> </asp:repeater>
how display 'secret info' column logged on users?
you can render <td>
elements conditionally. simplified example presumes have page-level property indicates whether or not user logged on (you'll want same thing in header template):
<asp:repeater id="repeater" runat="server> <itemtemplate> <tr> <td><asp:label id="label1" runat="server" text='<%# eval("name") %>' /></td> <% if (this.userisloggedon) { %> <td><asp:label id="label2" runat="server" text='<%# eval("secretinfo") %>' /></td> <% } %> <tr> </itemtemplate> </asp:repeater>
Comments
Post a Comment