<p>I have a radio button list on a page that is used to configure products. when the page loads the first time the first list of options is displayed. you select one of them then click a "Next Step" button and the page posts back and shows a new radio button list for step 2. Now if i click a "Previous Step" button i can easily get the previous list of options to display but i can not for some reason get one of the radio buttons to be selected. I can easily bring back the value i need. right after making the radio button list i have a step that just says radiobuttonlist.selected = "somevalue" depending on whatever the user chose when they completed the first step the first time.</p>

<p>when i debug i see that the value is correct and is being applied. but then when the page is displayed the radiobutton is not selected.</p>

<p>I have noticed that when i click my "Previous" button while debugging the folowing steps occur.:</p>

<p>the page.load handler runs and the code inside my if not page.ispostback block does NOT run, which is correct.
then the handles for the button i just clicked gets run.
but then after that the page.load handler runs again but this time the code in the if not page.ispostback block DOES run...</p>

<p>is that normal? for the page.onload block to run twice like that on a postback? i think it may have something to do with why my value is not being applied.</p>

[{'answer_id': 59835, 'author': 'ctrlShiftBryan', 'author_id': 6161, 'author_profile': 'https://Stackoverflow.com/users/6161', 'pm_score': 0, 'selected': False, 'text': '<p>Try setting <code>AutoEventWireup = False</code> in the page.</p>\n'}, {'answer_id': 59837, 'author': 'Thunder3', 'author_id': 2832, 'author_profile': 'https://Stackoverflow.com/users/2832', 'pm_score': 1, 'selected': False, 'text': '<p>It sounds like you are causing a redirect to happen. You aren\'t by chance doing a Response.Redirect in order to "get back" to the original page? This would cause the functionality you describe. You would first get the Postback from the Previous button to leave the page, and then you would get a fresh Request (IsPostback = false) as the page reloads.</p>\n'}, {'answer_id': 59842, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>I DID have a response.redirect i was using but i removed it. I suppose i can do a thorough check to make sure i didnt have another one anywhere. I will try the autoeventwireup property as well.</p>\n'}, {'answer_id': 59998, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>alright well it looks like the autoevenwriteup property was already set to false before i even started. so i don't think that was it. </p>\n\n<p>I didn't see any other redirects happening anywhere... i guess the search continues.</p>\n"}, {'answer_id': 60539, 'author': 'ipstset', 'author_id': 2558, 'author_profile': 'https://Stackoverflow.com/users/2558', 'pm_score': 0, 'selected': False, 'text': "<p>Have you tried setting the selected value during the page's pre-render phase instead of Page_Load?</p>\n"}, {'answer_id': 413434, 'author': 'netseng', 'author_id': 32718, 'author_profile': 'https://Stackoverflow.com/users/32718', 'pm_score': 0, 'selected': False, 'text': '<p>Try to do this</p>\n\n<pre><code>yourRadioButonList.Items.FindByValue(YourSavedValue).Selected = true;\n</code></pre>\n'}, {'answer_id': 1831750, 'author': 'bigfatlump', 'author_id': 222763, 'author_profile': 'https://Stackoverflow.com/users/222763', 'pm_score': 0, 'selected': False, 'text': '<p>I had the same issue, like what Thunder3 mentioned, I did a redirect back to the page, and was calling a method on Page_Load, to set the RadioButtonList selected value. But the selected value was not applied to the RadioButtonList. </p>\n\n<p>I solved the issue by calling the method on Page_Init instead.</p>\n'}, {'answer_id': 4915436, 'author': 'rs.emenu', 'author_id': 605565, 'author_profile': 'https://Stackoverflow.com/users/605565', 'pm_score': 0, 'selected': False, 'text': '<p>One of the probable reason, and the one which I faced recently is because of the fact that radiobuttonlist distinguish the items on the basis of value and not ID, thus if duplicate values exist, this issue will be observed.</p>\n\n<p>Below link provide the detailed explanation.</p>\n\n<p><a href="http://www.a2zmenu.com/Blogs/AspNet/RadioButtonList-selected-item-does-not-stick-on-postback.aspx" rel="nofollow">RadioButtonList selected item does not stick on postback</a></p>\n'}]
['https://Stackoverflow.com/questions/59829', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']