Note that there are some explanatory texts on larger screens.

plurals
  1. PODefault radio button not triggering an UpdateControl postback
    text
    copied!<p>I have three radio buttons on a form - A, B, C. Each of these selections populates a dropdown list with data specific to the option. When the form loads, I set option A to be checked (as the default). </p> <p>When I select buttons B or C, the AsyncPostBack triggers fine and the dropdown is populated. BUT, subsequently selecting A from either B or C does not trigger the event.</p> <p>I suspect that because A was checked when the form loaded, the browser is not seeing any "change" to raise the event. </p> <p>So what can be done to enable the default A button recognise it is being changed from B or C in order to raise the postback?</p> <p>I have tried both setting the checked state of button A in code on inital loading of the page only (ie IsPostBack is False) and alternatively setting the checked attribute of the radiobutton in the html, with the same results. If I don't default the radio button the functionality works as expected, except I don't have the radio button and dropdown list defaulted when the page first loads.</p> <hr> <p>The html...</p> <pre><code>&lt;asp:RadioButton ID="radBook" runat="server" AutoPostBack="true" GroupName="grpArticleType" Text="Book" /&gt; &lt;asp:RadioButton ID="radCD" runat="server" AutoPostBack="true" GroupName="grpArticleType" Text="CD" /&gt; &lt;asp:RadioButton ID="radDVD" runat="server" AutoPostBack="true" GroupName="grpArticleType" Text="DVD" /&gt; &lt;asp:UpdatePanel ID="pnlTasks" runat="server" UpdateMode="Conditional" RenderMode="Inline"&gt; &lt;ContentTemplate&gt; &lt;asp:DropDownList ID="dropShippingSize" runat="server" CssClass="dropdownMandatory"&gt;&lt;/asp:DropDownList&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="radBook" /&gt; &lt;asp:AsyncPostBackTrigger ControlID="radCD" /&gt; &lt;asp:AsyncPostBackTrigger ControlID="radDVD" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <hr> <p>The code behind...</p> <pre><code>Sub Page_Load If Not Me.IsPostBack Then radBook.Checked = True End If End Sub Private Sub rad_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles radBook.CheckedChanged, radCD.CheckedChanged, radDVD.CheckedChanged zLoadShippingSizeDropdown() End Sub </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload