【发布时间】:2013-07-19 02:30:05
【问题描述】:
我无法从单选按钮列表中获取单选按钮以在 IF 语句中被选中。当 IF 为真时,其他一切都正常工作,除了这个。 Request Pending 是默认值,但我需要能够在 IF 为 True 时选择“等待批准”按钮。
我的 HTML 代码是:
<asp:RadioButtonList ID="rbGiftStatus" RepeatDirection="Horizontal"
runat="server" TabIndex="3">
<asp:ListItem Text="Request Pending" Selected="True" Value="1"></asp:ListItem>
<asp:ListItem Text="Check Pending" Value="2"></asp:ListItem>
<asp:ListItem Text="Completed" Value="3"></asp:ListItem>
<asp:ListItem Text="Waiting for Approval" Value="4"></asp:ListItem>
</asp:RadioButtonList>
我的 C# 是这样的:
rbGiftStatus.SelectedIndex = 4;
我也尝试过其他方法,例如:
rbGiftStatus.Text = "4";
rbGiftStatus.SelectedItem = "4";
rbGiftStatus.SelectedValue = "4";
它们似乎都不起作用,我不知道为什么
【问题讨论】:
标签: c# asp.net radiobuttonlist