2011-06-15 94 views
0

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

<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> 

我要提交wothout按键,只要选择列表项之后。这是可能的,怎么样?

回答

6

设置AutoPostBack="true"RadioButtonList

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

看看RadioButtonList控件公开的事件,并将您的代码放入正确的事件处理程序中。我想你应该设置为TrueAutoPostBack的控件。