Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting CheckBox control Text property in a Repeater Control

Status
Not open for further replies.

GadeDinesh

Programmer
Mar 17, 2011
1
US
I have a checkbox in a repeater control. How to get the User,Administrator,Security Admin as the checkbox Names ?

private string[] AvailableRoles = { "User", "Administrator", "Security Admin" };

Repeater_Roles.DataSource = AvailableRoles; Repeater_Roles.DataBind();

<asp:Repeater ID="Repeater_Roles" OnItemDataBound="Repeater_Roles_ItemDataBound" runat="server">
<ItemTemplate>
<asp:CheckBox ID="CheckBox_Roles" runat="server" />
</ItemTemplate>
</asp:Repeater>


Thanks in Advance
.
 
I'm having difficulty understanding your problem. are you using a repeater to create a list of check boxes? do you want to set the value of each checkbox?
Code:
<asp:Repeater ID="Repeater_Roles" OnItemDataBound="Repeater_Roles_ItemDataBound" runat="server">
   <ItemTemplate>
   <asp:CheckBox ID="CheckBox_Roles" runat="server" value='<%@#Container.DataItem%>' />
   </ItemTemplate>
</asp:Repeater>
but it begs the question: why not use the checkboxlist control instead?

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top