I have an ASP.NET application and I would like to display all roles and add a checkbox which is checked if the user has the right. I use an ASP repeater to get all roles but how can I check the checkbox in the same repeater to get the user's role ? Here is my code:
<asp:Repeater ID="RepeaterRole" runat="server" DataSourceID="ObjectDataSource2">
<ItemTemplate>
<div>
<asp:CheckBox runat="server" Checked="False" />
<asp:Label CssClass="lbl" ID="Label1" runat="server" Text='<%# Eval("RoleLabel")%>'></asp:Label>
<asp:Label ID="Label2" runat="server" Visible="false" Text='<%# Eval("RoleCode")%>'></asp:Label>
</div>
</ItemTemplate>
</asp:Repeater>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetAllRolesToCollection" TypeName="Business.BusinessObject.Role"></asp:ObjectDataSource>
Aucun commentaire:
Enregistrer un commentaire