Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

UpdatePanel won't trigger SelectedIndexChanged event when default index is selected.

$
0
0

I have a RadioButtonList with a default selection (i.e., Selected="true") and AutoPostBack set to true.  In addition, I have an ASP.Net AJAX UpdatePanel around a separate control to be disabled/enabled, as applicable. The UpdatePanel triggers the aforementioned RadioButtonList control for the SelectedIndexChanged event. This works great when a user selects a ListItem from the RadioButtonList other than the default selection. However, my problem is that if the user changes his mind, and re-selects the default selection, the SelectedIndexChanged event does not fire (it does not post back).  As a result, controls that need to be disabled remain enabled. Note that I only have this problem when using the UpdatePanel. If I delete the UpdatePanel and its related controls, such that the entire page must reload, the SelectedIndexChanged control fires...even when selecting the default RadioButtonList ListItem.

Sample code is below. I would appreciate any insight into how to get ASP.Net AJAX to post back when a user re-selects the default ListItem in a RadioButtonList (note, setting the default in the page_load event didn't work either). Thanks in advance for any and all feedback!

<asp:RadioButtonList ID="rblHighestDegree" runat="server" AutoPostBack="true"
       
onselectedindexchanged="rblHighestDegree_SelectedIndexChanged">
   
<asp:listitem Runat="server" Text="Master's Degree" Selected="True" />
   
<asp:listitem Runat="server" Text="Doctorate" />
</asp:RadioButtonList>

<asp:ScriptManager ID="scriptmanager1" runat="server" />
<asp:UpdatePanel ID="updatepanel1" runat="server">
<ContentTemplate>
<asp:textbox id="txtEmployerTypeCurator" Runat="server" width="200" MaxLength="100"></asp:textbox>
</ContentTemplate>
<Triggers>
 
<asp:AsyncPostBackTrigger ControlID="rblHighestDegree" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>


Viewing all articles
Browse latest Browse all 5678

Trending Articles