服务器控件中的 Sitecore 链接不会引发事件

发布于 2024-11-03 07:40:22 字数 593 浏览 3 评论 0原文

我开发了一个自定义服务器控件来处理显示搜索结果(包括分页)以供在 Sitecore 中使用。除了分页机制不起作用之外,该控件在某种程度上工作正常。我手工制作了分页机制,它由 LinkBut​​ton 组成,它触发代码隐藏中的事件处理程序方法。现在,分页机制在 Sitecore 之外工作正常,但在 Sitecore 环境中似乎不起作用(它触发回发正常,但“分页”事件没有被触发)。在我的上一个问题中(有没有办法对 ASP.NET 回发进行低级调试)有人提到了 Sitecore 中的 typesThatShouldNotBeExpanded web.config 设置,该设置修复了标准 asp.net 服务器的类似问题控件(在这种情况下是 ListView),但这种技术似乎不适用于我的服务器控件。

typesThatShouldNotBeExpanded 设置生效之前,我需要使用其他设置来向 sitecore 注册我的程序集吗?

I've developed a custom server control to handle displaying search results (including paging) for use in Sitecore. The control works OK to a point, except that the paging mechanism does not work. I've hand crafted the paging mechanism and it consists of LinkButtons which trigger an event handler method in the code-behind. Now the paging mechanism works fine outside of Sitecore, but does not seem to work in the Sitecore environment (it triggers postbacks OK, but the 'paging' event is not being fired). In a previous question of mine (Is there a way to do low-level debugging of ASP.NET PostBacks) someone mentioned the typesThatShouldNotBeExpanded web.config setting in Sitecore which has fixed a similar issue with standard asp.net server controls (a ListView in that case), but this technique doesn't seem to work for my server control.

Is there some other setting I need to use to register my assembly with sitecore, before the typesThatShouldNotBeExpanded setting can take effect?

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

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

发布评论

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

评论(1

半寸时光 2024-11-10 07:40:22

这不起作用的原因是因为我忘记让我的控件类继承 System.Web.UI.WebControls.CompositeControl - 当我说我已经在 Sitecore 之外测试了这个时,我已经测试过代码的非常相似的版本,但它继承了 CompositeControl 基类。这对于包含子控件的服务器控件是必需的。请注意,web.config 文件仍然需要包含适当的设置。

The reason this didn't work was because I had forgotten to make my control class inherit from System.Web.UI.WebControls.CompositeControl - when I said I had tested this outside of Sitecore, I had tested a very similar version of the code, but which did inherit the CompositeControl base class. This is required for server controls which contain child controls. Note, It was still necessary for the web.config file to contain the appropriate setting.

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