跳过中继器的 ItemDataBound 事件

发布于 2024-12-11 06:47:07 字数 205 浏览 4 评论 0原文

有没有办法可以跳过中继器的 ItemDataBound 事件,例如在事件中使用 e.Handled = true 。我知道 RepeaterItemEventArgs 不包含 Handled 属性。

实际上,我想在数据列表的数据绑定事件中绑定中继器,因为中继器的绑定事件被调用两次。因此,在第二次调用 ItemDataBound 事件时,我想跳过该事件。

Is there a way I can skip ItemDataBound event of the repeater like using e.Handled = true inside the event. I know RepeaterItemEventArgs does not contain a Handled property.

Actually I want to bind repeater inside a datalist's databound event due to which repeater's bound event is called twice. So on second call of the ItemDataBound event I want to skip the event.

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

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

发布评论

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

评论(1

一袭白衣梦中忆 2024-12-18 06:47:07

存储一个布尔标志,其默认值为 true,并且在您的事件中您应该有如下内容:

if (myFlag) {
myFlag = false;
//Content of the method
}
else myFlag = true;

Store a boolean flag which will have a default value of true and inside your event you should have something like this:

if (myFlag) {
myFlag = false;
//Content of the method
}
else myFlag = true;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文