Why does the whole page do postback and RadioButton loses its value?

I want a selection from a radio button to run a query to populate a DropDownList. I do not want the whole page to do a postback. My whole page is posting back.

Also, when I copy this page to a test page, the value of the radio button is lost. I need the radio button to drive they query which populates the dropdown.

What am I doing wrong which is causing a full postback?

(The method "FillAppointmentTypes_SelectedIndexChanged" is never executed.)

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>


<asp:UpdatePanel ID="updatePanelToggle" runat="server">

  <ContentTemplate>
    <div class="form-group">
      <label for="radDoctors" class="col-md-3 control-label">
        Choose your doctor: <span id="asdf"></span>
      </label>
      <div class="col-md-9">
        <asp:RadioButtonList ID="radDoctors" runat="server" CssClass="" 
          OnSelectedIndexChanged="FillAppointmentTypes_SelectedIndexChanged"
          AutoPostBack="True">
        </asp:RadioButtonList>
      </div>
    </div>
    <div class="form-group">
      <label for="ddAppointmentTypes" class="col-md-3 control-label">
        Reason for Visit: <span id="Span1"></span>
      </label>
      <div class="col-md-9">
        <asp:DropDownList ID="ddAppointmentTypes" runat="server">
        </asp:DropDownList>
      </div>
    </div>
  </ContentTemplate>
</asp:UpdatePanel>

I have tried a trigger inside the updatedatePanel and outside the content template, no love:

<Triggers>
  <asp:AsyncPostBackTrigger ControlID="radDoctors" EventName="SelectedIndexChanged" />
</Triggers>

Answers


Put...

if(page.ispostback) 
{
return;
}

At the top of your page load event..

Hope this helps

Also maybe set the ChildAsTrigger="true" on the updatepanel


Need Your Help

Package Ruby to a standalone Mac OS X application?

ruby macos

I know Python has py2app. I was wondering if Ruby has anything like that. I know there is OCRA (One-Click Ruby Application builder) for Windows, but what about for Mac OS X?

Change label in masterpage in just one content page

c# asp.net label master-pages

How do I define a label in a masterpage from inside one control page, withouth losing it when I navigate to another control page? I know that I can use this code and it works: