DropDownList_OnSelectedIndexChanged事件,在用户控件不开火回传 [英] DropDownList_OnSelectedIndexChanged event, In a UserControl is not firing on postback

查看:212
本文介绍了DropDownList_OnSelectedIndexChanged事件,在用户控件不开火回传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我忘了提这个asp.net 2.0。

I forgot to mention this asp.net 2.0.

用户控件都有一个唯一的ID,它是在pageLoad的事件时加载。
用户控制被装载到面板和面板是web部件的内部。
下拉已自动回设置为true。

The user control has a unique id and it is loaded in the PageLoad event. The user control is loaded into a panel and the panel is inside of a webpart. The dropdown has autopostback set to true.

=的EnableViewState上的下拉如此。
该ListItems的是在下拉菜单中创建pre-render事件的方法。

EnableViewState = true on the dropdown. The ListItems are created in the dropdowns pre-render event method.

这就是为什么我不明白为什么它不射击,下拉是导致该用户回发控制的唯一的事情。

This is why I don't understand why it is not firing, the dropdown is the only thing that causes postback on this user control.

由于用户控件在页面加载方法加载回发应该发生的下拉事件再次方法吧?

The event methods for the dropdown should occur since the user control is loaded in the page load method on postback again right?

推荐答案

确认不存在的OnLoad或者说是重新绑定下拉列表的数据源pageLoad的事件。重新绑定一个新的数据集的数据可能会导致不永远得到执行的函数clickhandler

Make sure there is no OnLoad or PageLoad event that is rebinding the datasource of the dropdown list. Rebinding the data with a new set of data may cause the clickhandler to not ever get executed.

请确保您有如果(!Page.IsPostBack)围绕 dropdownlist.datasource = dropdownlist.databind()

这篇关于DropDownList_OnSelectedIndexChanged事件,在用户控件不开火回传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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