ASP.NET Web 部件静态连接

发布于 2024-07-18 09:49:46 字数 375 浏览 5 评论 0原文

我在两个不同的 Web 部件区域中有两个 Web 部件。 他们使用网格视图提供主/详细信息场景。 它们是使用静态连接定义的。 最初这效果很好。

一旦我关闭其中一个 Web 部件,我就会收到消息“您即将关闭该 Web 部件。它当前正在向其他 Web 部件提供数据,如果关闭此 Web 部件,这些连接将被删除。单击“确定”继续。

这在 ,当我打开目录区域并重新添加 Web 部件(添加得很好)时,部件之间的连接已断开(如消息所述)。

本身很好,所以我单击“关闭”,我的部件关闭。但是 在我的 HTML 中仍然可见。我只能假设它使用 ASPNET 成员资格或其他来记住连接的 ID,而不是启用它。

我的问题是如何在代码或其他中重新启用连接!

I have two webparts in two different webpart zones. They provide a Master/Details scenario using gridviews. They are defined using static connections. Initially this works great.

As soon as I close one of the webparts I get the message "You are about to close the webpart. It is currently providing data to other webparts, and these connections will be deleted if this webpart is closed. Click OK to continue.

This in itself is fine so I click close and my part closes. However when I open the catalog zone and re-add the webpart (which gets added fine) the connection between the parts is broken (as described by the message).

However my webpart connection in my HTML is still visible. I can only assume it uses the ASPNET membership or other to remember the ID of the connection and not to enable it.

My question is how do I re-enable the connection in code or other!?

Thanks.

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

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

发布评论

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

评论(1

荒芜了季节 2024-07-25 09:49:46

好的,我已经解决了我的问题。 我将以下内容添加到 WebpartManager.WebpartAdded() 中,

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Dim wp1 As WebPart = zoneDiaryTopLeft.WebParts("Ucl_Diary_Summary1")
    Dim wp2 As WebPart = zoneDiaryTopRight.WebParts("Ucl_DiaryAwaitingReview1")

    Dim providerConnectionPoint As ProviderConnectionPoint = _
    WebPartManager1.GetProviderConnectionPoints(wp1)("IMessageProvider")

    Dim consumerConnectionPoint As ConsumerConnectionPoint = _
    WebPartManager1.GetConsumerConnectionPoints(wp2)("IMessageConsumer")

    Dim returnValue As WebPartConnection
    returnValue = WebPartManager1.ConnectWebParts(wp1, providerConnectionPoint, wp2, consumerConnectionPoint)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

总而言之,它如何知道/存储已删除的连接并记住不允许其处于活动状态!? 如果我可以阻止连接被删除或重新启用它,那就容易多了。 我知道动态连接是一种选择,但我不希望用户拥有这种能力,因为他们很难理解您可以在屏幕上拖动 Web 部件这一事实。 对他们来说,人脉关系就像火箭科学。

OK I have solved my issue. I added the following into WebpartManager.WebpartAdded()

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Dim wp1 As WebPart = zoneDiaryTopLeft.WebParts("Ucl_Diary_Summary1")
    Dim wp2 As WebPart = zoneDiaryTopRight.WebParts("Ucl_DiaryAwaitingReview1")

    Dim providerConnectionPoint As ProviderConnectionPoint = _
    WebPartManager1.GetProviderConnectionPoints(wp1)("IMessageProvider")

    Dim consumerConnectionPoint As ConsumerConnectionPoint = _
    WebPartManager1.GetConsumerConnectionPoints(wp2)("IMessageConsumer")

    Dim returnValue As WebPartConnection
    returnValue = WebPartManager1.ConnectWebParts(wp1, providerConnectionPoint, wp2, consumerConnectionPoint)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

All said, how does it know/store the connection that was removed and remember to NOT allow that to be active!? It would be much easier if I could stop the connection being removed or re-enable it. I know dynamic connections are an option but I dont want users having this ability as they having a hard enough job understanding the fact you can drag a webpart around the screen. Connections are rocketscience to them.

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