In ASP.net I have a simple textbox and radio button list with yes or no options. On the VB server-side I implement OnClick of the radio button and it does things.
<asp:RadioButtonList ID="rbltest" runat="server" AutoPostBack="true" OnSelectedIndexChange="rbltest_SelectedIndexChanged" <asp:ListItem Text="Yes" Value="0"></asp:ListItem>
<asp:ListItem Selected="True" Text="No" Value="1"></asp:ListItem>
</asp:RadioButtonList>
The only problem is simply that if I click the radio button, then enter data into the TextBox (immediately – in less than 2 seconds), when the radio button returns, it deletes the data. This is annoying. Is there anyway around it?
The only way to fix this is to remove
AutoPostBack=trueon theRadioButtonListcontrol. The auto-postback option immediately initiates an HTTP post back to the server, so anything typed after then is going to be lost.Other options:
onclickhandler, and disable the text while the post-back processes (ie, make it clear to the user that they can’t type anything, aka the principle of least astonishment).