简体   繁体   中英

can i use radio button list as Submit button?

i have:

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

i want to submit wothout button, just after selecting list item. is it possible and how??

Set AutoPostBack="true" for your RadioButtonList

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

Look at the event exposed by the RadioButtonList control and put your code in the proper event handler. I guess you should set to True AutoPostBack of the control as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM