我有一个加载用户控件自定义控件(编译为DLL)。 (即,自定义控制做了LoadControl)在用户控件是一个按钮和一个文本框。我电汇了按钮的单击事件。
I have a custom control (compiled as a DLL) which loads a user control. (i.e, the custom control does a LoadControl) In the user control is a button and a textbox. I wire up the button's click event.
我在一个值在文本框中键入。当我点击该按钮,页面做了回发。我的用户控件知道回发发生,因为Page.IsPostBack =真实的。但是,该按钮的单击事件从来没有发射,我的文本框也失去了,我在键入的值。
I type in a value into the text box. When I click the button, the page does a postback. My user control knows that a postback occured because Page.IsPostBack = true. However, the click event of the button is never fired and my text box has also lost the value that I typed in.
任何人有任何想法,以什么可能是怎么回事?
Anyone have any thoughts as to what might be going on?
编辑:我做了这个测试并采取的SharePoint出来的图片;我是能够重现它,所以我删除了所有引用到SharePoint。
I did a test on this and took SharePoint out of the picture; I was able to reproduce it so I removed all references to SharePoint.
推荐答案如果您是动态加载用户控件,你必须为了重新装载每个页面加载(回发或不)为.NET处理器知道在哪里要连接提交事件。
If you are dynamically loading the user control, you have to reload it on each page load (postback or not) in order for the processor to know where to wire up the submit event.
更多推荐
自定义控件加载用户控件;回发事件不会被触发
发布评论