asp.net 自定义服务器控件 - 如何判断是否由于该控件而发生回发

发布于 2024-07-28 23:49:48 字数 136 浏览 8 评论 0原文

我有一个自定义的 asp.net 服务器控件(实际上是复选框的专用版本)。 我想对回发进行一些处理,但前提是回发是单击此控件的结果(自动回发设置为 true)。 确定回发是此控制的结果还是其他原因的最佳方法是什么?

感谢您的帮助。

I have a custom asp.net server control (actually a specialized version of a checkbox). I want to do some processing on a postback but only if the postback was a result of this control being clicked (with autopostback being set to true). What is the best way to determine if the postback is a result of this control or something else?

Thanks for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

殊姿 2024-08-04 23:49:48

您也许可以让它工作:

构建逻辑,告诉您发回哪个控件:

http: //www.eggheadcafe.com/articles/20050609.asp

Cory Larson 评论也很好......:)

You might be able to get this to work:

Build logic that tells you which control posted back:

http://www.eggheadcafe.com/articles/20050609.asp

Cory Larson comment is also a good one... :)

狠疯拽 2024-08-04 23:49:48

听起来您可以使用 事件冒泡 。 基本上,您只需从自定义服务器控件中公开复选框中的 onchange 事件(如果您的服务器控件是复合控件)。 然后在托管控件的页面的事件处理程序中编写特殊处理代码。

It sounds like you could use event bubbling. Basically you would just expose the onchange event in your checkbox (if your server control is a composite control) from you custom server control. Then write your special handling code in an eventhandler in the page hosting the control.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文