日期:2014-05-17 浏览次数:20516 次
<asp:Repeater ID="Repeater1" runat="server"
onitemdatabound="Repeater1_ItemDataBound">
<ItemTemplate>
<asp:RadioButtonList ID="RadioButtonList2" runat="server">
<asp:ListItem Text="正常" Value="0"></asp:ListItem>
<asp:ListItem Text="异常" Value="1"></asp:ListItem>
</asp:RadioButtonList>
<asp:HiddenField ID="HiddenField1" runat="server" Value='<%#Eval("state") %>' />
</ItemTemplate>
</asp:Repeater>
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
RadioButtonList rbl = (RadioButtonList)e.Item.FindControl("RadioButtonList2");
HiddenField hf = (HiddenField)e.Item.FindControl("HiddenField1");
rbl.SelectedValue = hf.Value;
}