RadioButtonList (with a default value) SelectedIndexChanged doesn't work with ASP.NET Ajax - by Lee Timmins

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 508710 Comments
Status Closed Workarounds
Type Bug Repros 4
Opened 11/6/2009 2:28:26 AM
Access Restriction Public


If you have a RadioButtonList with a pre-selected item the SelectedIndexChanged event doesn't fire when re selecting this item if wrapped in an update panel.
Sign in to post a comment.
Posted by Phil2415 on 8/19/2011 at 4:00 AM
I have to agree - this is a bug. Just because it is known and the reason for it is logical doesn't mean that it isn't something which needs fixing!
Posted by Saffy on 8/31/2010 at 4:05 AM
If this is by design, then it's a flawed design!
I'd love to see this behaviour changed as I end up with loads of extra updatepanels cluttering up my pages as a result.

The problem appears to be a line in RadioButton.RenderInputTag:
        if ((this.AutoPostBack && !this.Checked) && (this.Page != null))

which suggests that this problem is not confined to radiobuttonlists, but to radiobuttons in general. It should be obvious that radio buttons may be unchecked and then re-checked, so this piece of code (which looks to be an attempt to save unnecessary overhead) is sadly unhelpful. I don't see anything similar in the code for the checkbox, interestingly enough.
Posted by Lee Timmins on 11/19/2009 at 5:06 AM
How can this issue be marked as "By Design"? This is clearly a bug and your solution is simply a workaround.
Posted by Lee Timmins on 11/13/2009 at 12:59 AM
Hi cheers. I've been using method 2 to fix this issue but it stills seems like a hack. Method 1 is typically not that useful say if i have a form and when a user selects a value from a radio button list it displays other elements on the form and potentially re-binds some of the data. The problem with method 2 is that it's only a good alternative if the form elements are close together otherwise a large amount of data requires updating which can make the page quite slow.
Posted by Microsoft on 11/12/2009 at 4:29 PM
Thanks again for submitting this issue. When the RadioButtonList renders to the client it puts a click event on the inputs that are not selected and does not put the click event on the selected input. This gets updated on post back, but since your page is not posting back the click events do not get updated. In short your event is always only fired when you click on Yes because this is the input that has the click event.

There is a couple of ways to fix this.
1) Turn off AutoPostBack on the RadioButtonList and add a button that has your code in the OnClick event of the button. Set the trigger in the update panel to the button.
2) Move the RadioButtonList into the UpdatePanel and continue to use AutoPostBack. The side affect here is that radio button will re-render when you change the selection since it is now in the update panel.
Posted by Microsoft on 11/11/2009 at 10:27 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you
Posted by Microsoft on 11/9/2009 at 12:54 AM
Thank you for your feedback, We are currently reviewing the issue you have submitted.