相关疑难解决方法(0)

在Repeater控件中DropDownList,无法触发SelectedIndexChanged

我有一个转发器控件,在页脚中我有一个DropDownList.在我的代码隐藏中,我有:

protected void ddMyRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
    if (e.Item.ItemType == ListItemType.Item
            || e.Item.ItemType == ListItemType.AlternatingItem)
    {
       // Item binding code
    }

    else if (e.Item.ItemType == ListItemType.Footer)
    {
        DropDownList ddl = e.Item.FindDropDownList("ddMyDropDownList");
        // Fill the list control
        ddl.SelectedIndexChanged += new  
           EventHandler(ddMyDropDownList_SelectedIndexChanged);
        ddl.AutoPostBack = true;
    }
 }
Run Code Online (Sandbox Code Playgroud)

页面显示为PostBack但是我的EventHandler没有被调用.有任何想法吗?

c# asp.net

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

asp.net ×1

c# ×1