0

I want to execute the event but it does not work. I've tried to fix the problem by adding AutoPostBack = "true", but it did not work. I've also tried to activate the same event on another DropDownList without success.

<div class="col-sm-3" style="float: left">
  <div class="input-group input-group-md" style="padding-top: 6px; width: 308px;">
    <asp:DropDownList ID="ddlCountry" runat="server" Width="250px" CssClass="form-control" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged" AutoPostBack="true">
    </asp:DropDownList>
  </div>
</div>
 protected void ddlCountry_SelectedIndexChanged(object sender,EventArgs e)
 {
     fillCity(Convert.ToInt32(ddlCountry.SelectedValue));
 }
Nicholas Miller
  • 4,205
  • 2
  • 39
  • 62
  • Have you tried [this solution](https://stackoverflow.com/a/4079566)? – NightOwl888 Jan 21 '18 at 21:35
  • I oppose this to be closed as duplicate. User has already used AutoPostBack in this problem. – SSD Jan 21 '18 at 21:58
  • If the question marked as duplicate serves your purpose then good enough. Otherwise see this link to how to Re-open the question. https://meta.stackexchange.com/questions/217393/falsely-duplicate-question-on-stackoverflow – SSD Jan 21 '18 at 22:14

1 Answers1

0

AutoPostBack Is must for Dropdownlist to fire SelectedIndexChange event. Since this you have already tried. See following.

Your question is showing partial html of your page, but I am sure there might be more input controls. You must try to see following :

  1. If there are some RequiredFieldValidators make sure they are not getting fired (validated) for any missing input.
  2. Try CausesValidation=«false» on dropdown list, in case any validation is firing, this will avoid it being fired.

If 1 & 2 is not the case then try putting these dropdownlist out of any parent container and run test again.

SSD
  • 1,373
  • 2
  • 13
  • 20