Reputation: 573
I have a webpage with 3 UpdatePanels on. They all work perfectly and have used UpdatePanels for years now and never come across this issue.
The RadioButtonList is posting back the entire page rather than the UpdatePanel and can't see any errors in the output. I have never seen this behaviour before and copied the code into another project, and it worked as expected. All other controls on the page are working as expected in the same format.
Is there any other reasons that this behaviour could occur? My code below:
ASPX Code:
<asp:RadioButtonList ID="rbSelectWeek" runat="server" ClientIDMode="Static" CssClass="rb-select" OnSelectedIndexChanged="rbSelectWeek_SelectedIndexChanged" AutoPostBack="true" >
<asp:ListItem Text="Previous" Value="1" />
<asp:ListItem Text="Current" Value="2" Selected="True" />
<asp:ListItem Text="Next" Value="3" />
<asp:ListItem Text="All" Value="4" />
</asp:RadioButtonList>
<asp:UpdatePanel ID="upCaseViewer" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:HiddenField ID="dtFrom" runat="server" ClientIDMode="Static" Value="1900-01-01" />
<asp:HiddenField ID="dtEnd" runat="server" ClientIDMode="Static" Value="9999-12-31" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cmbTeam" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="rbSelectWeek" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
VB.Net / C#
Protected Sub rbSelectWeek_SelectedIndexChanged(sender As Object, e As EventArgs) Handles rbSelectWeek.SelectedIndexChanged
Dim sVal As Integer = rbSelectWeek.SelectedValue
rbSelectWeek.ClearSelection()
rbSelectWeek.SelectedValue = sVal
Select Case sVal
Case 1
dtFrom.Value = getFunctions.getPrevWeek("Start")
dtEnd.Value = getFunctions.getPrevWeek("End")
Case 2
dtFrom.Value = getFunctions.getCurrWeek("Start")
dtEnd.Value = getFunctions.getCurrWeek("End")
Case 3
dtFrom.Value = getFunctions.getNextWeek("Start")
dtEnd.Value = getFunctions.getNextWeek("End")
Case Else
dtFrom.Value = getFunctions.getAll("Start")
dtEnd.Value = getFunctions.getAll("End")
End Select
End Sub
Upvotes: 1
Views: 39
Reputation: 35514
AsyncPostBackTriggers do not work when an referenced element uses ClientIDMode="Static"
. So change it to
<asp:RadioButtonList ID="rbSelectWeek" runat="server" CssClass="rb-select" OnSelectedIndexChanged="rbSelectWeek_SelectedIndexChanged" AutoPostBack="true" >
<asp:ListItem Text="Previous" Value="1" />
<asp:ListItem Text="Current" Value="2" Selected="True" />
<asp:ListItem Text="Next" Value="3" />
<asp:ListItem Text="All" Value="4" />
</asp:RadioButtonList>
Upvotes: 2