SelectedIndexChanged事件不会触发 [英] SelectedIndexChanged event doesn't fire

查看:130
本文介绍了SelectedIndexChanged事件不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 AutoPostBack ="true" 属性添加到下拉列表中.这是行不通的.

I have added the AutoPostBack = "true" attribute to the drop down list. It doesn't work.

<asp:DropDownList CssClass="dropDownList" ID="ddlBusinessUnit" 
                  AutoPostBack="true" runat="server" Width="250px"   
                  OnSelectedIndexChanged="ddlBusinessUnit_SelectedIndexChanged">
</asp:DropDownList>

后面的代码:

Protected Sub ddlBusinessUnit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    Response.Write("Hello")
End

如何确保调用事件方法?

How can I ensure that the event method is called?

推荐答案

您是否在每次回发中都填充Dropdownlist?

Are you populating your Dropdownlist on every Postback?

使用

Use IsPostBack to check whether the page is loaded for the first time or not.

If Not IsPostBack Then
   BinDdlBusinessUnit()
End If

这篇关于SelectedIndexChanged事件不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆