我可以使用单选按钮列表作为提交按钮吗?

时间:2011-06-15 13:02:51

标签: c# asp.net radio-button submit radiobuttonlist

我有:

<asp:RadioButtonList ID="selectedYesNoQuestionBlock7" runat="server" 
    RepeatDirection="Horizontal" OnSelectedIndexChanged="Question7GotAnswered">
    <asp:ListItem Text="Yes" Value="1"></asp:ListItem>
    <asp:ListItem Text="No" Value="0"></asp:ListItem>
</asp:RadioButtonList>

....

<div id="btCreate" style="margin-left: 254px; margin-top: 10px;">
    <asp:Button runat="server" Text="Categorize" ID="btCategorize" />
</div>

我想在选择列表项后立即提交无按钮。它有可能吗?

2 个答案:

答案 0 :(得分:6)

AutoPostBack="true"

设置RadioButtonList
<asp:RadioButtonList AutoPostBack="True" ID="selectedYesNoQuestionBlock7" 
      runat="server" RepeatDirection="Horizontal" 
                OnSelectedIndexChanged="Question7GotAnswered">
 ...
</asp:RadioButtonList>

答案 1 :(得分:1)

查看RadioButtonList控件公开的事件,并将代码放入正确的事件处理程序中。我猜你也应该设置为控件的 True AutoPostBack