ASP.NET DropDownList AutoPostback Not Working - What Am I Missing?

删除回忆录丶 提交于 2019-11-29 14:55:42

I was able to get it to work with what you posted. This is the code I used... Basically what you had but I am throwing an exception.

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

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" ChildrenAsTriggers="true" >      
      <ContentTemplate>
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"  onselectedindexchanged="DropDownList1_SelectedIndexChanged">
          <asp:ListItem>item 1</asp:ListItem>
          <asp:ListItem>item 2</asp:ListItem>
        </asp:DropDownList>
      </ContentTemplate>
    </asp:UpdatePanel>



    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        throw new NotImplementedException();
    }

I tried a lot of variations to see if there was something off, but the exception was thrown every time.

You might want to try the exception route to see if the postback is happening and this isn't a debugger issue.

  • One issue might be with Vista and not running Visual Studios as administrator. I know that has a tendency to not allow debugging.

  • Maybe the assembly you are running doesn't match the code? This might happen if you "View in Browswer" and then attach the debugger.

Does it work when you take out the UpdatePanel?

EnableViewState="true" in UpdatePannel will definitely resolve the problem.

I too had the same issues,strangely enough my updatepanel was firing OnTextChanged in FireFox but was dead on IE. Restartin VS 2005 fixed the issue. :O

Rather than using AutoPostBack="true" set the DropList as a trigger in the update panel.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!