自定义控件加载用户控件;回发事件不会被触发

编程入门 行业动态 更新时间:2024-10-27 02:26:29
本文介绍了自定义控件加载用户控件;回发事件不会被触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个加载用户控件自定义控件(编译为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.

更多推荐

自定义控件加载用户控件;回发事件不会被触发

本文发布于:2023-10-12 21:39:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1485974.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   自定义   加载   事件   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!