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(仅触发一次)存在问题