C# selectedindexchanged事件未触发

C# selectedindexchanged事件未触发,c#,asp.net,drop-down-menu,C#,Asp.net,Drop Down Menu,我有三个dropdownlists,其中autopostaback=true,但问题是第二个dropdownlist只调用pageload,但它的selectedindexchanged没有启动!我能做什么?(dropdownlists在updatepanel中) 您必须在updatepanel中放置一个异步触发器。试试这个: <asp:UpdatePanel id="up1" runat="server" updatemode="conditional"> <Trigg

我有三个
dropdownlists
,其中
autopostaback=true
,但问题是第二个
dropdownlist
只调用
pageload
,但它的
selectedindexchanged
没有启动!我能做什么?(
dropdownlists
updatepanel
中)


您必须在updatepanel中放置一个异步触发器。试试这个:

<asp:UpdatePanel id="up1" runat="server" updatemode="conditional">
   <Triggers>
      <asp:AsyncPostBackTrigger ControlID="ddl" EventName="SelectedIndexChanged" />
   </Triggers>
   <ContentTemplate>
      <%-- your content here --%>
      <asp:DropdownList id="ddl" AutoPostback="true" OnSelectedIndexChanged="handler" />
   </ContentTemplate>
</asp:UpdatePanel>

您必须在updatepanel中放置一个异步触发器。试试这个:

<asp:UpdatePanel id="up1" runat="server" updatemode="conditional">
   <Triggers>
      <asp:AsyncPostBackTrigger ControlID="ddl" EventName="SelectedIndexChanged" />
   </Triggers>
   <ContentTemplate>
      <%-- your content here --%>
      <asp:DropdownList id="ddl" AutoPostback="true" OnSelectedIndexChanged="handler" />
   </ContentTemplate>
</asp:UpdatePanel>

我最近也遇到了同样的问题。我还从数据库表填充了我的
dropdownlist
,我尝试了一切,包括在控件上设置
AutoPostBack=true
。事实证明,这是一个已知的错误,您可以通过将索引0设置为类似“选择一个人”的虚拟项来解决。请点击此处查看帖子:


这解决了我的问题。

我最近也遇到了同样的问题。我还从数据库表填充了我的
dropdownlist
,我尝试了一切,包括在控件上设置
AutoPostBack=true
。事实证明,这是一个已知的错误,您可以通过将索引0设置为类似“选择一个人”的虚拟项来解决。请点击此处查看帖子:


这就解决了我的问题。

您有任何
DataBind
加载调用吗?把那些拿走。只有当
IsPostBack
为false时,才应在第一次请求时进行数据绑定。请发布您的代码加载时是否有任何
DataBind
调用?把那些拿走。只有当
IsPostBack
为false时,才应在第一次请求时进行数据绑定。请发布您的代码,但对于其他元素,最后一个参数SelectedIndexChanged not fired(仅触发一次)存在问题,对于其他元素,则为ok,但对于最后一个参数SelectedIndexChanged not fired(仅触发一次)存在问题