我有以下中继器,其中包含一个单选按钮:
<asp:Repeater ID="RptLeaveRequests" runat="server"
onitemdatabound="RptLeaveRequests_ItemDataBound">
<ItemTemplate>
<table id="tableItem" runat="server">
//displaying other data which is not relevant to qeustion
<td style="50px">
<asp:RadioButtonList ID="rbtVerified" runat="server" >
<asp:ListItem Value="1">Accept</asp:ListItem>
<asp:ListItem Value="2">Reject</asp:ListItem>
</asp:RadioButtonList>
</td>
<td>
<asp:TextBox ID="txtNotes" runat="server" ></asp:TextBox>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
现在正在从代码中的方法填充数据:
DataTable dt = new LeaveLogic().GetManagerUnverifiedLeaveRequests(Convert.ToInt32(Context.User.Identity.Name));
if (dt.Rows.Count > 0)
{
RptLeaveRequests.DataSource = dt;
RptLeaveRequests.DataBind();
}
如果从调用的数据库(和 DataTable dt)中检索的记录为真,如何遍历每一行并禁用/隐藏单选按钮ReadOnly
?
这应该放在Repeater_ItemDataBound
方法中还是其他地方?