Asp.net Control behaviour on browser back button click
<p>Why is it that with an asp.net list control eg a RadioButtonList when you click the radio buttons in order (eg 0, 1, 2, and 3) and then click the browser back button the selected button stays the same (on index 3) and requires a further click of the browser back button to go back to button 2.</p>

<p>In the following web form I want to keep the selected radiobuttonlist, label, and querystring in sync. This all works fine if a user clicks the radiobuttons however if they hit the web browser back button the selected radio button becomes one step out of synch with the label and querystring.</p>

<p>Is there any way to keep them all in sync?</p>

<p>Note that I am still learning Asp.net.</p>

<pre><code>&lt;%@ Page Language="C#" %&gt;

    &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

    &lt;script runat="server"&gt;

        protected void SelectedIndexChanged(object sender, EventArgs e)
        {
            var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
            nameValues.Set("button", ButtonList1.SelectedIndex.ToString());
            string QueryString = "?" + nameValues.ToString();
            Response.Redirect(Request.Url.AbsolutePath + QueryString);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["button"] != null)
                {
                    int button = Convert.ToInt32(Request.QueryString["button"]);
                    ButtonList1.SelectedIndex = button;
                    ButtonIndex.Text = "Button has index" + ButtonList1.SelectedIndex.ToString(); 
                }
            }

        }

    &lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head id="Head1" runat="server"&gt;
    &lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server"&gt;
        &lt;div&gt;
        &lt;asp:RadioButtonList AutoPostBack="true" RepeatDirection="Horizontal" OnSelectedIndexChanged="SelectedIndexChanged"  id="ButtonList1"  runat="server"&gt;
                &lt;asp:ListItem Selected="True"&gt;0&lt;/asp:ListItem&gt;
                &lt;asp:ListItem&gt;1&lt;/asp:ListItem&gt;
                &lt;asp:ListItem&gt;2&lt;/asp:ListItem&gt;
                &lt;asp:ListItem&gt;3&lt;/asp:ListItem&gt;
                &lt;asp:ListItem&gt;4&lt;/asp:ListItem&gt;
            &lt;/asp:RadioButtonList&gt;
            &lt;asp:Label ID="ButtonIndex" Text="" runat="server"&gt;&lt;/asp:Label&gt;&lt;/br&gt;
        &lt;/div&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
